fix: 修复设备详情-定时器新增时对象绑定深层问题;
This commit is contained in:
parent
81360a0387
commit
e6dfcdbf6b
|
@ -247,6 +247,9 @@ export default {
|
||||||
deviceKey() {
|
deviceKey() {
|
||||||
this.getList();
|
this.getList();
|
||||||
},
|
},
|
||||||
|
list() {
|
||||||
|
this.monthTradingTableHeight = this.list.length >= 5 ? '290px' : ''
|
||||||
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getDicts("timer_mod").then((response) => {
|
this.getDicts("timer_mod").then((response) => {
|
||||||
|
@ -327,14 +330,15 @@ export default {
|
||||||
"{m}-{d}-{h}-{i}"
|
"{m}-{d}-{h}-{i}"
|
||||||
);
|
);
|
||||||
let list = this.list.map((v, idx) => {
|
let list = this.list.map((v, idx) => {
|
||||||
return v.num === this.form.num
|
let result = v.num === this.form.num
|
||||||
? Object.assign(v, this.form, { num: ++idx })
|
? Object.assign(v, this.form, { num: ++idx })
|
||||||
: Object.assign(v, { num: ++idx });
|
: Object.assign(v, { num: ++idx });
|
||||||
|
return JSON.parse(JSON.stringify(result));
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!this.updateIndex) {
|
if (!this.updateIndex) {
|
||||||
this.form.num = list.length + 1;
|
this.form.num = list.length + 1;
|
||||||
list = list.concat([this.form]);
|
list = list.concat([JSON.parse(JSON.stringify(this.form))]);
|
||||||
}
|
}
|
||||||
this.list = [...list]
|
this.list = [...list]
|
||||||
this.open = false;
|
this.open = false;
|
||||||
|
@ -378,7 +382,6 @@ export default {
|
||||||
getDeviceTimingConfig(this.deviceKey)
|
getDeviceTimingConfig(this.deviceKey)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
this.list = response.data;
|
this.list = response.data;
|
||||||
this.monthTradingTableHeight = this.list.length >= 5 ? '290px' : 'auto'
|
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
|
|
Loading…
Reference in New Issue