Browse Source

bug of sort items

star7th 4 năm trước cách đây
mục cha
commit
49940d3de4
1 tập tin đã thay đổi với 2 bổ sung17 xóa
  1. 2 17
      web_src/src/components/item/Index.vue

+ 2 - 17
web_src/src/components/item/Index.vue

@@ -499,25 +499,10 @@ export default {
         }
       })
     },
-    exchangeArray(data, oldIndex, newIndex) {
-      let tmp = data[oldIndex]
-      data.splice(oldIndex, 1)
-      data.splice(newIndex, 0, tmp)
-      return data
-    },
     endMove(evt) {
       let data = {}
-      let list = this.exchangeArray(
-        this.itemList,
-        evt['oldIndex'],
-        evt['newIndex']
-      )
-      this.itemList = []
-      this.$nextTick(() => {
-        this.itemList = list
-      })
-      for (var i = 0; i < list.length; i++) {
-        let key = list[i]['item_id']
+      for (var i = 0; i < this.itemList.length; i++) {
+        let key = this.itemList[i]['item_id']
         data[key] = i + 1
       }
       this.sort_item(data)