应答器添加原编号并导入
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( const messageIndex = titleKeys.findIndex(
(key) => title[key] === '报文1023bits' (key) => title[key] === '报文1023bits'
); );
const originalCodeIndex = titleKeys.findIndex(
(key) => title[key] === '应答器编号'
);
dataList.forEach((data, i) => { dataList.forEach((data, i) => {
if (i > index) { if (i > index) {
const tranCode = const tranCode =
@ -126,6 +129,9 @@ function onCreate() {
datas.fixedUserTelegram = data[ datas.fixedUserTelegram = data[
titleKeys[userMessageIndex] titleKeys[userMessageIndex]
].replaceAll(' ', ''); ].replaceAll(' ', '');
datas.originalCode = data[
titleKeys[originalCodeIndex]
].replaceAll(' ', '');
transpnder.updateData(datas); transpnder.updateData(datas);
} }
} }

View File

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

View File

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

View File

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

View File

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

View File

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