From e43ef98ce771d3e71c15b43e7d43ad393f46d8c6 Mon Sep 17 00:00:00 2001 From: haiyangcui Date: Sat, 17 Oct 2020 21:11:50 +0200 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=8E=86=E5=8F=B2=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E7=9A=84=E6=8B=96=E6=9B=B3=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/History.vue | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) 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) } }) }