Browse Source

分类管理排序

qymljy 1 year ago
parent
commit
d3ccb3dbdb

+ 27 - 1
src/WebsiteManagement/consultManage/modules/classManage.vue

@@ -105,7 +105,13 @@ export default {
         "id": "20240727133403",
         "content": row
       })
+      if (res.code == 0){
+        this.tool.showMessage(res,()=>{
+
+        })
+      }
       this.listData()
+
     },
     updateDate(row){
       this.sat_notice = row.sat_notice_classid
@@ -153,7 +159,27 @@ export default {
       this.drawer = false
     },
     rowSort(data){
-      this.list = data
+      data.forEach((item,index)=>{
+        console.log(item.classname,item.index,item.sequence,index)
+        item.sequence = index
+      })
+      this.$nextTick(async()=>{
+        let sequencesorts = data.map(item=>{
+          console.log(item.sequence,item.classname)
+          return {
+            ownerid:item.sat_notice_classid,
+            sequence:item.sequence
+          }
+        })
+        const res = await this.$api.requested({
+          id:20221201134901,
+          content:{
+            ownertable:'sat_notice_class',
+            sequencesorts:sequencesorts
+          }
+        })
+      })
+      this.listData()
     }
   },
   created() {

+ 4 - 6
src/components/dynamic-newTable/index2.vue

@@ -76,18 +76,16 @@ export default {
       }
     },
     initSort() {
-      console.log('执行了换个位置')
       if (!this.isRowSort) return
       const el = this.$refs['table'].$el.querySelector('.el-table__body-wrapper > table > tbody')
       new Sortable(el, {
         animation: 150, // 动画
         onEnd: evt => {
-          console.log(evt,'evt11')
           const curRow = this.data.splice(evt.oldIndex, 1)[0]
-          console.log(curRow,'curRow22')
-          this.data.splice(evt.newIndex, 0, curRow)
-          console.log(this.data,'表格数据')
-          this.$emit('rowSort', this.data)
+          this.$nextTick(()=>{
+            this.data.splice(evt.newIndex, 0, curRow)
+            this.$emit('rowSort', this.data)
+          })
         }
       })
     }