|
|
@ -27,45 +27,50 @@ export default class Mocks extends Vue { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Watch('personalCode', { immediate: true }) |
|
|
|
@Watch('personalCode', { immediate: true }) |
|
|
|
onPersonalCodeChanged (value: string, oldValue: string) { |
|
|
|
onPersonalCodeChanged () { |
|
|
|
|
|
|
|
this.refreshMocks() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
refreshMocks () { |
|
|
|
this.mode === Mode.UPDATE && httpClient.mockConfigurations({ personalCode: this.personalCode }) |
|
|
|
this.mode === Mode.UPDATE && httpClient.mockConfigurations({ personalCode: this.personalCode }) |
|
|
|
.then((data: any) => { |
|
|
|
.then((data: any) => { |
|
|
|
|
|
|
|
const existServiceKeys = [] |
|
|
|
for (const mockConfiguration of data.data) { |
|
|
|
for (const mockConfiguration of data.data) { |
|
|
|
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
|
|
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
|
|
// @ts-ignore
|
|
|
|
// @ts-ignore
|
|
|
|
this.registers[mockConfiguration.code] = mockConfiguration.value |
|
|
|
this.registers[mockConfiguration.code] = mockConfiguration.value |
|
|
|
this.register2Id[mockConfiguration.code] = mockConfiguration.id |
|
|
|
this.register2Id[mockConfiguration.code] = mockConfiguration.id |
|
|
|
|
|
|
|
existServiceKeys.push(mockConfiguration.code) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
for (const serviceCode in this.registers) { |
|
|
|
} |
|
|
|
if (existServiceKeys.indexOf(serviceCode) > -1) { |
|
|
|
|
|
|
|
continue |
|
|
|
onXteeMtaChanged () { |
|
|
|
|
|
|
|
if (this.mode !== Mode.UPDATE) { |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
if (this.register2Id.xtee_mta === 'undefined') { |
|
|
|
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
|
|
return |
|
|
|
// @ts-ignore
|
|
|
|
|
|
|
|
this.registers[serviceCode] = '' |
|
|
|
|
|
|
|
delete this.register2Id[serviceCode] |
|
|
|
} |
|
|
|
} |
|
|
|
httpClient.changeMockValueConfiguration({ |
|
|
|
|
|
|
|
id: this.register2Id.xtee_mta, |
|
|
|
|
|
|
|
value: this.registers.xtee_mta |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
.then((data: any) => { |
|
|
|
|
|
|
|
console.log('updateMock') |
|
|
|
|
|
|
|
console.log(data) |
|
|
|
|
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
onRiaChanged () { |
|
|
|
async onServiceChanged (serviceKey: string) { |
|
|
|
if (this.mode !== Mode.UPDATE) { |
|
|
|
if (this.mode !== Mode.UPDATE) { |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
if (this.register2Id.ria === 'undefined') { |
|
|
|
if (typeof this.register2Id[serviceKey] === 'undefined') { |
|
|
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
|
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
|
|
|
await this.saveMock(this.personalCode, serviceKey, Number(this.registers[serviceKey])) |
|
|
|
|
|
|
|
await this.refreshMocks() |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
httpClient.changeMockValueConfiguration({ |
|
|
|
httpClient.changeMockValueConfiguration({ |
|
|
|
id: this.register2Id.ria, |
|
|
|
id: this.register2Id[serviceKey], |
|
|
|
value: this.registers.ria |
|
|
|
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
|
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
|
|
|
value: this.registers[serviceKey] |
|
|
|
}) |
|
|
|
}) |
|
|
|
.then((data: any) => { |
|
|
|
.then((data: any) => { |
|
|
|
console.log('updateMock') |
|
|
|
console.log('updateMock') |
|
|
@ -94,4 +99,19 @@ export default class Mocks extends Vue { |
|
|
|
console.log(data) |
|
|
|
console.log(data) |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
saveMock (personalCode: string, serviceCode: string, value: number): Promise<any> { |
|
|
|
|
|
|
|
const mockConfigurations: MockConfiguration[] = [] |
|
|
|
|
|
|
|
const mockConfiguration = new MockConfiguration() |
|
|
|
|
|
|
|
mockConfiguration.personalCode = personalCode |
|
|
|
|
|
|
|
mockConfiguration.code = serviceCode |
|
|
|
|
|
|
|
mockConfiguration.value = value |
|
|
|
|
|
|
|
mockConfiguration.active = 'true' |
|
|
|
|
|
|
|
mockConfigurations.push(mockConfiguration) |
|
|
|
|
|
|
|
return httpClient.addMockConfigurations({ items: mockConfigurations }) |
|
|
|
|
|
|
|
.then((data: any) => { |
|
|
|
|
|
|
|
console.log('saveMocks') |
|
|
|
|
|
|
|
console.log(data) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|