diff --git a/src/components/History.vue b/src/components/History.vue index 93d30ad..c36c35d 100644 --- a/src/components/History.vue +++ b/src/components/History.vue @@ -5,11 +5,10 @@ 清空 -
+
{ + var id = length + data.forEach(ele => { + ele.id = id + id -= 1 + history.add(ele) + }) + }) + }, rowDrop () { - const tbody = document.getElementById('history-table').querySelector('.el-table__body-wrapper tbody') + const tbody = document.getElementById('list-table').querySelector('.el-table__body-wrapper tbody') const _this = this Sortable.create(tbody, { onEnd ({ newIndex, oldIndex }) { const currRow = _this.history.splice(oldIndex, 1)[0] _this.history.splice(newIndex, 0, currRow) - history.clear().then(res => { - var id = _this.history.length - _this.history.forEach(element => { - element.id = id - history.add(element) - id -= 1 - }) - }) + _this.updateDatabase(_this.history) } }) }