来回切换3个状态值如何得到对应ID的最后一个对象
var is_push = () => {
for (var i = 0; i < this.form.FaultDevices.length; i++) {
if (this.form.FaultDevices[i].ID === row.ID) {
return i;
}
}
return -1;
}
var index = is_push()
if (value !== -1) {
var data = {
FGuid: "",
ID: row.ID,
DeviceId: row.DeviceId,
HandleState: value
}
if (index !== -1) {
this.form.FaultDevices[index] = data
} else {
this.form.FaultDevices.push(data)
}
} else {
if (index !== -1) {
this.form.FaultDevices.splice(index, 1);
}
}