Убрал лишние запросы
This commit is contained in:
parent
3411794a08
commit
b2c297a7fd
@ -5,6 +5,6 @@
|
||||
</label>
|
||||
<div v-if="personalCode">
|
||||
<hr />
|
||||
<Mocks :personalCode="personalCode"></Mocks>
|
||||
<Mocks :mode="'update'" :personalCode="personalCode"></Mocks>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -60,6 +60,6 @@
|
||||
<div class="memory-panel">Memory: {{copyText}}</div>
|
||||
<div v-if="personalCode">
|
||||
<hr />
|
||||
<Mocks :personalCode="personalCode"></Mocks>
|
||||
<Mocks :mode="'add'" :personalCode="personalCode"></Mocks>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user