Убрал лишние запросы
This commit is contained in:
parent
3411794a08
commit
b2c297a7fd
@ -5,6 +5,6 @@
|
|||||||
</label>
|
</label>
|
||||||
<div v-if="personalCode">
|
<div v-if="personalCode">
|
||||||
<hr />
|
<hr />
|
||||||
<Mocks :personalCode="personalCode"></Mocks>
|
<Mocks :mode="'update'" :personalCode="personalCode"></Mocks>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -16,7 +16,9 @@ export default class Mocks extends Vue {
|
|||||||
@Prop()
|
@Prop()
|
||||||
personalCode!: string
|
personalCode!: string
|
||||||
|
|
||||||
mode: Mode = Mode.ADD
|
@Prop()
|
||||||
|
mode!: Mode
|
||||||
|
|
||||||
registers = new Registers()
|
registers = new Registers()
|
||||||
register2Id: Record<string, string> = {}
|
register2Id: Record<string, string> = {}
|
||||||
|
|
||||||
@ -26,20 +28,21 @@ export default class Mocks extends Vue {
|
|||||||
|
|
||||||
@Watch('personalCode', { immediate: true })
|
@Watch('personalCode', { immediate: true })
|
||||||
onPersonalCodeChanged (value: string, oldValue: string) {
|
onPersonalCodeChanged (value: string, oldValue: string) {
|
||||||
this.mode = Mode.ADD
|
this.mode === Mode.UPDATE && httpClient.mockConfigurations({ personalCode: this.personalCode })
|
||||||
httpClient.mockConfigurations({ personalCode: this.personalCode })
|
|
||||||
.then((data: any) => {
|
.then((data: any) => {
|
||||||
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
|
||||||
this.mode = Mode.UPDATE
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
onXteeMtaChanged () {
|
onXteeMtaChanged () {
|
||||||
|
if (this.mode !== Mode.UPDATE) {
|
||||||
|
return
|
||||||
|
}
|
||||||
if (this.register2Id.xtee_mta === 'undefined') {
|
if (this.register2Id.xtee_mta === 'undefined') {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -54,6 +57,9 @@ export default class Mocks extends Vue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onRiaChanged () {
|
onRiaChanged () {
|
||||||
|
if (this.mode !== Mode.UPDATE) {
|
||||||
|
return
|
||||||
|
}
|
||||||
if (this.register2Id.ria === 'undefined') {
|
if (this.register2Id.ria === 'undefined') {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -60,6 +60,6 @@
|
|||||||
<div class="memory-panel">Memory: {{copyText}}</div>
|
<div class="memory-panel">Memory: {{copyText}}</div>
|
||||||
<div v-if="personalCode">
|
<div v-if="personalCode">
|
||||||
<hr />
|
<hr />
|
||||||
<Mocks :personalCode="personalCode"></Mocks>
|
<Mocks :mode="'add'" :personalCode="personalCode"></Mocks>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user