应答器添加原编号并导入
All checks were successful
CI / Docker-Build (push) Successful in 2m27s

This commit is contained in:
joylink_fanyuhong 2024-03-25 14:06:41 +08:00
parent 6c94a8a511
commit 504b8cf825
7 changed files with 62 additions and 10 deletions

@ -1 +1 @@
Subproject commit a1534096aa1ed2566b93ffe7bfde76750de10a60
Subproject commit 86b35d3ead9a269f812b105d8a30a43c019da8bc

View File

@ -105,6 +105,9 @@ function onCreate() {
const messageIndex = titleKeys.findIndex(
(key) => title[key] === '报文1023bits'
);
const originalCodeIndex = titleKeys.findIndex(
(key) => title[key] === '应答器编号'
);
dataList.forEach((data, i) => {
if (i > index) {
const tranCode =
@ -126,6 +129,9 @@ function onCreate() {
datas.fixedUserTelegram = data[
titleKeys[userMessageIndex]
].replaceAll(' ', '');
datas.originalCode = data[
titleKeys[originalCodeIndex]
].replaceAll(' ', '');
transpnder.updateData(datas);
}
}

View File

@ -40,6 +40,13 @@
</template>
</q-item>
</q-list>
<q-input
outlined
class="q-mt-md"
v-model="transponderModel.originalCode"
@blur="onUpdate"
label="原编号"
/>
<q-select
outlined
class="q-mt-md"

View File

@ -91,6 +91,7 @@ import { graphicData } from 'src/protos/stationLayoutGraphics';
const lineStore = useLineStore();
const transponderState = ref<TransponderState>(new TransponderState());
const code = ref('');
const originalCode = ref('');
const type = ref(0);
const kilometer = ref(0);
enum TransponderOperation {
@ -144,6 +145,7 @@ interface KeyType {
const list: KeyType[] = [
{ label: '应答器索引', key: 'code' },
{ label: '应答器名称', key: 'code', formatFn: getNameFormat },
{ label: '应答器原编号', key: 'code', formatFn: getOriginalCodeFormat },
{ label: '坐标系', key: 'km', formatFn: getCoordinateSystemFormat },
{ label: '公里标', key: 'km', formatFn: getKilometerFormat },
{ label: '方向', key: 'km', formatFn: getDirectionFormat },
@ -162,6 +164,9 @@ const list1: KeyType[] = [
function getNameFormat(v: string) {
return code.value || v;
}
function getOriginalCodeFormat(v: string) {
return originalCode.value || v;
}
function getCoordinateSystemFormat(v: graphicData.KilometerSystem) {
return v.coordinateSystem;
}
@ -198,6 +203,7 @@ function initTransponderState(transponder: Transponder) {
copySelectGraphic = toRaw(transponder);
code.value = transponder.datas.code;
type.value = transponder.datas.type;
originalCode.value = transponder.datas.originalCode;
kilometer.value = transponder.states.km?.kilometer || 0;
transponderState.value = transponder.states.clone() as TransponderState;
subscribeState(transponder);

View File

@ -24,14 +24,15 @@ import {
resetMessageTransponder,
resetPositionTransponder,
stopTransponderTelegram,
sendTransponderTelegram
sendTransponderTelegram,
} from 'src/api/Simulation';
import { errorNotify } from 'src/utils/CommonNotify';
import { state } from 'src/protos/device_state';
export class TransponderData
extends GraphicDataBase
implements ITransponderData {
implements ITransponderData
{
constructor(data?: graphicData.Transponder) {
let transponder;
if (!data) {
@ -92,6 +93,12 @@ export class TransponderData
set type(v: TransponderTypeEnum) {
this.data.type = v;
}
get originalCode(): string {
return this.data.originalCode;
}
set originalCode(v: string) {
this.data.originalCode = v;
}
clone(): TransponderData {
return new TransponderData(this.data.cloneMessage());
}
@ -127,7 +134,8 @@ const TransponderOperationMenu: ContextMenu = ContextMenu.init({
export class TransponderState
extends GraphicStateBase
implements ITransponderState {
implements ITransponderState
{
constructor(proto?: state.BaliseState) {
let states;
if (proto) {
@ -150,10 +158,10 @@ export class TransponderState
return this.states.km
? this.states.km
: new graphicData.KilometerSystem({
coordinateSystem: '',
kilometer: 0,
direction: 0,
});
coordinateSystem: '',
kilometer: 0,
direction: 0,
});
}
set km(v: graphicData.KilometerSystem) {
this.states.km = new graphicData.KilometerSystem(v);

View File

@ -37,6 +37,8 @@ export interface ITransponderData extends GraphicData {
set fixedUserTelegram(v: string);
get type(): TransponderTypeEnum; // 应答器类型
set type(v: TransponderTypeEnum);
get originalCode(): string; //原编号
set originalCode(v: string);
clone(): ITransponderData;
copyFrom(data: ITransponderData): void;
eq(other: ITransponderData): boolean;
@ -217,8 +219,8 @@ export class Transponder extends JlGraphic {
this.states.km &&
this.states.km.kilometer === this.datas.kilometerSystem.kilometer &&
this.states.fixedTelegram === this.datas.fixedTelegram &&
this.states.fixedUserTelegram === this.datas.fixedUserTelegram
&& this.states.work
this.states.fixedUserTelegram === this.datas.fixedUserTelegram &&
this.states.work
) {
textColor = '#ffffff';
}

View File

@ -5345,6 +5345,7 @@ export namespace graphicData {
centralizedStations?: number[];
fixedTelegram?: string;
fixedUserTelegram?: string;
originalCode?: string;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [7, 10], this.#one_of_decls);
@ -5376,6 +5377,9 @@ export namespace graphicData {
if ("fixedUserTelegram" in data && data.fixedUserTelegram != undefined) {
this.fixedUserTelegram = data.fixedUserTelegram;
}
if ("originalCode" in data && data.originalCode != undefined) {
this.originalCode = data.originalCode;
}
}
}
get common() {
@ -5441,6 +5445,12 @@ export namespace graphicData {
set fixedUserTelegram(value: string) {
pb_1.Message.setField(this, 12, value);
}
get originalCode() {
return pb_1.Message.getFieldWithDefault(this, 13, "") as string;
}
set originalCode(value: string) {
pb_1.Message.setField(this, 13, value);
}
static fromObject(data: {
common?: ReturnType<typeof CommonInfo.prototype.toObject>;
code?: string;
@ -5451,6 +5461,7 @@ export namespace graphicData {
centralizedStations?: number[];
fixedTelegram?: string;
fixedUserTelegram?: string;
originalCode?: string;
}): Transponder {
const message = new Transponder({});
if (data.common != null) {
@ -5480,6 +5491,9 @@ export namespace graphicData {
if (data.fixedUserTelegram != null) {
message.fixedUserTelegram = data.fixedUserTelegram;
}
if (data.originalCode != null) {
message.originalCode = data.originalCode;
}
return message;
}
toObject() {
@ -5493,6 +5507,7 @@ export namespace graphicData {
centralizedStations?: number[];
fixedTelegram?: string;
fixedUserTelegram?: string;
originalCode?: string;
} = {};
if (this.common != null) {
data.common = this.common.toObject();
@ -5521,6 +5536,9 @@ export namespace graphicData {
if (this.fixedUserTelegram != null) {
data.fixedUserTelegram = this.fixedUserTelegram;
}
if (this.originalCode != null) {
data.originalCode = this.originalCode;
}
return data;
}
serialize(): Uint8Array;
@ -5545,6 +5563,8 @@ export namespace graphicData {
writer.writeString(11, this.fixedTelegram);
if (this.fixedUserTelegram.length)
writer.writeString(12, this.fixedUserTelegram);
if (this.originalCode.length)
writer.writeString(13, this.originalCode);
if (!w)
return writer.getResultBuffer();
}
@ -5581,6 +5601,9 @@ export namespace graphicData {
case 12:
message.fixedUserTelegram = reader.readString();
break;
case 13:
message.originalCode = reader.readString();
break;
default: reader.skipField();
}
}