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