|
|
|
@ -16,7 +16,9 @@ export default class Mocks extends Vue { |
|
|
|
|
@Prop() |
|
|
|
|
personalCode!: string |
|
|
|
|
|
|
|
|
|
mode: Mode = Mode.ADD |
|
|
|
|
@Prop() |
|
|
|
|
mode!: Mode |
|
|
|
|
|
|
|
|
|
registers = new Registers() |
|
|
|
|
register2Id: Record<string, string> = {} |
|
|
|
|
|
|
|
|
@ -26,20 +28,21 @@ export default class Mocks extends Vue { |
|
|
|
|
|
|
|
|
|
@Watch('personalCode', { immediate: true }) |
|
|
|
|
onPersonalCodeChanged (value: string, oldValue: string) { |
|
|
|
|
this.mode = Mode.ADD |
|
|
|
|
httpClient.mockConfigurations({ personalCode: this.personalCode }) |
|
|
|
|
this.mode === Mode.UPDATE && httpClient.mockConfigurations({ personalCode: this.personalCode }) |
|
|
|
|
.then((data: any) => { |
|
|
|
|
for (const mockConfiguration of data.data) { |
|
|
|
|
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
this.registers[mockConfiguration.code] = mockConfiguration.value |
|
|
|
|
this.register2Id[mockConfiguration.code] = mockConfiguration.id |
|
|
|
|
this.mode = Mode.UPDATE |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
onXteeMtaChanged () { |
|
|
|
|
if (this.mode !== Mode.UPDATE) { |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
if (this.register2Id.xtee_mta === 'undefined') { |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
@ -54,6 +57,9 @@ export default class Mocks extends Vue { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
onRiaChanged () { |
|
|
|
|
if (this.mode !== Mode.UPDATE) { |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
if (this.register2Id.ria === 'undefined') { |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|