This commit is contained in:
fan 2024-01-10 15:30:43 +08:00
commit 85e4f2da85
9 changed files with 120 additions and 90 deletions

View File

@ -22,7 +22,7 @@
"default-passive-events": "^2.0.0",
"echarts": "^5.4.3",
"google-protobuf": "^3.21.2",
"jl-graphic": "git+https://git.code.tencent.com/jl-framework/graphic-pixi.git#v0.1.0",
"jl-graphic": "git+https://git.code.tencent.com/jl-framework/graphic-pixi.git#v0.1.3",
"js-base64": "^3.7.5",
"pinia": "^2.0.11",
"quasar": "^2.6.0",

View File

@ -1,4 +1,5 @@
import { api } from 'src/boot/axios';
import { request } from 'src/protos/request';
const UriBase = '/api/v1/simulation';
@ -192,10 +193,10 @@ export async function getSimulationChannelName(): Promise<string> {
* @returns
*/
export async function setRelayState(data: {
id: number;
mapId: number;
simulationId: string;
td: boolean;
mapId: number;
deviceId: number;
operation: request.Relay.Operation;
}) {
return await api.post(`${UriBase}/relay/operation`, data);
}

View File

@ -3,11 +3,21 @@
<div v-if="menu.itemTypeFields">
<div class="row q-ma-sm" v-if="menu.type == typeStr.array">
<div
class="fit row no-wrap justify-between items-center"
class="fit row no-wrap justify-center items-center"
v-if="level != 1"
>
<div>{{ menu.description }}</div>
<q-btn dense flat color="primary" @click="add(menu)">添加</q-btn>
<q-item class="fit row no-wrap">
<q-item-section class="text-right q-px-md">
<q-item-label>{{ menu.description }}</q-item-label>
</q-item-section>
<q-item-section class="text-left q-px-md">
<div style="width: 300px">
<q-btn dense flat color="primary" @click="add(menu)"
>添加</q-btn
>
</div>
</q-item-section>
</q-item>
</div>
<div class="absolute-left z-top" v-else>
<q-btn dense flat color="primary" @click="add(menu)">添加</q-btn>
@ -57,49 +67,51 @@
</div>
<div v-else>
<q-item class="q-py-none">
<q-item-section>
<q-item-section class="text-right q-px-md">
<q-item-label>{{ menu.description }}</q-item-label>
</q-item-section>
<q-item-section>
<q-select
v-if="menu.selectOptions"
v-model="menu.val"
dense
outlined
:options="menu.selectOptions"
emitValue
mapOptions
>
</q-select>
<q-input
dense
v-model="menu.val"
v-else-if="menu.type == typeStr.string"
/>
<q-input
dense
type="number"
oninput="if(!/^\d+$/.test(value)) value=value.replace(/\D/g,''); "
@blur="blurFn"
v-model.number="menu.val"
v-else-if="
[typeStr.uint8, typeStr.uint16, typeStr.uint32].includes(
menu.type
)
"
/>
<q-input
dense
type="number"
oninput="if(/[\.]/.test(value)) value=value.replace(/[\.]/g,''); "
@blur="blurFn"
v-model.number="menu.val"
v-else-if="[typeStr.int, typeStr.int32].includes(menu.type)"
/>
<q-checkbox
v-model="menu.val"
v-else-if="menu.type == typeStr.bool"
/>
<q-item-section class="text-left q-px-md">
<div style="width: 300px">
<q-select
v-if="menu.selectOptions"
v-model="menu.val"
dense
outlined
:options="menu.selectOptions"
emitValue
mapOptions
>
</q-select>
<q-input
dense
v-model="menu.val"
v-else-if="menu.type == typeStr.string"
/>
<q-input
dense
type="number"
oninput="if(!/^\d+$/.test(value)) value=value.replace(/\D/g,''); "
@blur="blurFn"
v-model.number="menu.val"
v-else-if="
[typeStr.uint8, typeStr.uint16, typeStr.uint32].includes(
menu.type
)
"
/>
<q-input
dense
type="number"
oninput="if(/[\.]/.test(value)) value=value.replace(/[\.]/g,''); "
@blur="blurFn"
v-model.number="menu.val"
v-else-if="[typeStr.int, typeStr.int32].includes(menu.type)"
/>
<q-checkbox
v-model="menu.val"
v-else-if="menu.type == typeStr.bool"
/>
</div>
</q-item-section>
</q-item>
</div>

View File

@ -32,6 +32,7 @@ import { useQuasar } from 'quasar';
import { ApiError } from 'src/boot/axios';
import { Relay } from 'src/graphics/relay/Relay';
import { RelayState } from 'src/drawApp/relayCabinetGraphics/RelayInteraction';
import { request } from 'src/protos/request';
const $q = useQuasar();
const lineStore = useLineStore();
@ -42,8 +43,12 @@ const relayState = ref({
});
let operateOptions: {
label: string;
value: boolean;
}[] = [];
value: request.Relay.Operation;
}[] = [
{ label: '强制前接点位(吸起)', value: request.Relay.Operation.ForceQw },
{ label: ' 强制后接点位(落下)', value: request.Relay.Operation.ForceHw },
{ label: ' 取消强制', value: request.Relay.Operation.CancelForce },
];
let copySelectGraphic: Relay | null = null;
watch(
@ -73,9 +78,6 @@ function setNewRelayState(relay: Relay) {
code: relay.datas.code,
xh: relay.states.xh || false,
};
operateOptions = relay.states.xh
? [{ label: '驱动落下', value: false }]
: [{ label: '驱动吸起', value: true }];
subscribeState(relay);
}
@ -89,18 +91,15 @@ function unSubscribeState(g: Relay) {
function updateState(newVal: RelayState) {
relayState.value.xh = newVal.states.xh || false;
operateOptions = newVal.states.xh
? [{ label: '驱动落下', value: false }]
: [{ label: '驱动吸起', value: true }];
}
function changePosition(td: boolean) {
function changePosition(operation: request.Relay.Operation) {
if (lineStore.simulationId) {
setRelayState({
id: relayState.value.id,
mapId: lineStore.mapId as number,
simulationId: lineStore.simulationId,
td,
mapId: lineStore.mapId as number,
deviceId: relayState.value.id,
operation,
})
.then(() => {
$q.notify({ type: 'positive', message: '修改继电器状态成功' });

View File

@ -15,6 +15,7 @@ import { DisplayObject, FederatedMouseEvent } from 'pixi.js';
import { setRelayState } from 'src/api/Simulation';
import { ApiError } from 'src/boot/axios';
import { errorNotify, successNotify } from 'src/utils/CommonNotify';
import { request } from 'src/protos/request';
export class RelayData extends GraphicDataBase implements IRelayData {
constructor(data?: relayCabinetGraphicData.Relay) {
@ -92,14 +93,15 @@ export class RelayState extends GraphicStateBase implements IRelayState {
}
}
const setOpen: MenuItemOptions = { name: '驱动落下' };
const setClose: MenuItemOptions = { name: '驱动吸起' };
const setOpen: MenuItemOptions = { name: '强制后接点位(落下)' };
const setClose: MenuItemOptions = { name: '强制前接点位(吸起)' };
const cancelForce: MenuItemOptions = { name: '取消强制' };
export class RelayOperationPlugin extends GraphicInteractionPlugin<Relay> {
static Name = 'relay_operate_menu';
relayOperationMenu: ContextMenu = ContextMenu.init({
name: 'Relay操作',
groups: [{ items: [setOpen, setClose] }],
groups: [{ items: [setOpen, setClose, cancelForce] }],
});
constructor(app: IGraphicScene) {
@ -137,12 +139,12 @@ export class RelayOperationPlugin extends GraphicInteractionPlugin<Relay> {
const mapId = useLineStore().mapId as number;
setOpen.disabled = !relay.states.xh;
setClose.disabled = relay.states.xh;
const changeRelayState = async (td: boolean) => {
const changeRelayState = async (operation: request.Relay.Operation) => {
setRelayState({
id: relay.datas.id,
mapId,
simulationId,
td,
mapId,
deviceId: relay.datas.id,
operation,
})
.then(() => {
successNotify('修改继电器状态成功');
@ -153,10 +155,13 @@ export class RelayOperationPlugin extends GraphicInteractionPlugin<Relay> {
});
};
setOpen.handler = () => {
changeRelayState(false);
changeRelayState(request.Relay.Operation.ForceHw);
};
setClose.handler = () => {
changeRelayState(true);
changeRelayState(request.Relay.Operation.ForceQw);
};
cancelForce.handler = () => {
changeRelayState(request.Relay.Operation.CancelForce);
};
this.relayOperationMenu.open(e.global);
}

View File

@ -39,7 +39,7 @@ import {
MenuItemOptions,
AbsorbableLine,
AbsorbablePosition,
AbsorbablePoint
AbsorbablePoint,
} from 'jl-graphic';
import { graphicData } from 'src/protos/stationLayoutGraphics';
import { AxleCounting } from '../axleCounting/AxleCounting';
@ -339,21 +339,26 @@ export class SectionGraphicHitArea implements IHitArea {
function buildAbsorbablePositions(section: Section): AbsorbablePosition[] {
const aps: AbsorbablePosition[] = [];
const sections = section.queryStore.queryByType<Section>(Section.Type);
sections.forEach((other) => {
const [ps, pe] = [
other.localToCanvasPoint(other.getStartPoint()),
other.localToCanvasPoint(other.getEndPoint()),
];
const { width, height } = section.getGraphicApp().canvas;
const xs = new AbsorbableLine({ x: 0, y: ps.y }, { x: width, y: ps.y });
const ys = new AbsorbableLine({ x: ps.x, y: 0 }, { x: ps.x, y: height });
const xe = new AbsorbableLine({ x: 0, y: pe.y }, { x: width, y: pe.y });
const ye = new AbsorbableLine({ x: pe.x, y: 0 }, { x: pe.x, y: height });
aps.push(xs, ys, xe, ye);
const [ps, pe] = [
section.localToCanvasPoint(section.getStartPoint()),
section.localToCanvasPoint(section.getEndPoint()),
];
const { width, height } = section.getGraphicApp().canvas;
const xs = new AbsorbableLine({ x: 0, y: ps.y }, { x: width, y: ps.y });
const ys = new AbsorbableLine({ x: ps.x, y: 0 }, { x: ps.x, y: height });
const xe = new AbsorbableLine({ x: 0, y: pe.y }, { x: width, y: pe.y });
const ye = new AbsorbableLine({ x: pe.x, y: 0 }, { x: pe.x, y: height });
aps.push(xs, ys, xe, ye);
const sections = section.queryStore
.queryByType<Section>(Section.Type)
.filter((g) => g.datas.sectionType == SectionType.Physical);
sections.forEach((item) => {
if (item.id !== section.id) {
item.localToCanvasPoints(...item.datas.points).forEach((p) => {
aps.push(new AbsorbablePoint(p));
});
}
});
const turnouts = section.queryStore.queryByType<Turnout>(Turnout.Type);
turnouts.forEach((turnout) => {
turnout.getPortPoints().forEach((points) => {
@ -533,10 +538,10 @@ export class SectionPointEditPlugin extends GraphicInteractionPlugin<Section> {
if (
(dir === 'ltr' &&
sectionData.points[0].x >
sectionData.points[sectionData.points.length - 1].x) ||
sectionData.points[sectionData.points.length - 1].x) ||
(dir === 'rtl' &&
sectionData.points[0].x <
sectionData.points[sectionData.points.length - 1].x)
sectionData.points[sectionData.points.length - 1].x)
) {
codeAppend = codeAppend.split('').reverse().join('');
}

View File

@ -885,7 +885,7 @@ function oneClickRelateCentralizedStation() {
);
containDeviceIds = Array.from(new Set(containDeviceIds));
});
if (rightBoundary.datas.refRightStationId) {
if (!rightBoundary.datas.refRightStationId) {
handleContainDevices(containDeviceIds, []);
} else {
handleContainDevices(containDeviceIds, [

View File

@ -144,7 +144,7 @@ const columnDefs: QTableColumn[] = [
{ name: 'id', label: 'ID', field: 'id', align: 'center' },
{
name: 'name',
label: '用户名',
label: '权限接口名称',
field: 'name',
required: true,
align: 'center',

View File

@ -47,11 +47,13 @@
<q-dialog
v-model="createFormShow"
full-width
maximized
persistent
transition-show="scale"
transition-hide="scale"
>
<q-card style="width: 500px">
<q-card>
<q-card-section>
<q-form ref="myForm" @submit="onCreate" @reset="onReset">
<div class="text-h6 q-my-md">
@ -90,7 +92,10 @@
:key="index"
:name="item.fieldName"
>
<div style="height: 350px; overflow-y: auto; padding: 5px">
<div
:style="{ height: tabPanelHeight + 'px' }"
style="overflow-y: auto; padding: 5px"
>
<ConfigData
:cgData="item"
:level="1"
@ -147,6 +152,9 @@ const props = withDefaults(
const tableHeight = computed(() => {
return props.sizeHeight - 32;
});
const tabPanelHeight = computed(() => {
return props.sizeHeight - 289;
});
onMounted(() => {
tableRef.value.requestServerInteraction();