更新拖拽

This commit is contained in:
gyq
2024-06-27 10:08:40 +08:00
parent d53314b523
commit 5110bd6d57
4 changed files with 231 additions and 186 deletions

View File

@@ -18,7 +18,7 @@
</el-table-column>
<el-table-column label="操作" width="240">
<template v-slot="scope">
<el-button type="text" icon="el-icon-rank">排序</el-button>
<el-button type="text" icon="el-icon-rank" v-if="isPcBowser">排序</el-button>
<el-button type="text" size="mini" round icon="el-icon-edit" @click="$refs.addGroupRef.show(scope.row)"
style="margin-left: 20px !important;">编辑</el-button>
<el-popconfirm title="确定删除吗?" @confirm="delHandle([scope.row.id])">
@@ -56,9 +56,11 @@ export default {
},
mounted() {
this.getTableData()
this.$nextTick(() => {
this.tableDrag()
})
if (this.isPcBowser) {
this.$nextTick(() => {
this.tableDrag()
})
}
},
methods: {
//表格拖拽

View File

@@ -17,7 +17,7 @@
</el-select>
</el-col>
<el-col :span="6">
<el-button type="primary" @click="getTableData">查询</el-button>
<el-button type="primary" @click="queryHandle">查询</el-button>
<el-button @click="resetHandle">重置</el-button>
</el-col>
</el-row>
@@ -80,7 +80,7 @@
</el-table-column>
<el-table-column label="操作" width="200">
<template v-slot="scope">
<el-button type="text" icon="el-icon-rank">排序</el-button>
<el-button type="text" icon="el-icon-rank" v-if="isPcBowser">排序</el-button>
<router-link :to="{ path: '/product/add_shop', query: { goods_id: scope.row.id } }"
style="margin-left: 20px !important;">
<el-button type="text" icon="el-icon-edit">编辑</el-button>
@@ -125,14 +125,21 @@ export default {
}
}
},
mounted() {
this.getTableData()
this.tbShopCategoryGet()
this.$nextTick(() => {
this.tableDrag()
})
async mounted() {
await this.tbShopCategoryGet()
await this.getTableData()
if (this.isPcBowser) {
this.$nextTick(() => {
this.tableDrag()
})
}
},
methods: {
// 选择分类
queryHandle() {
localStorage.setItem('shopIndexQuery', JSON.stringify(this.query))
this.getTableData()
},
//表格拖拽
tableDrag() {
const el = document.querySelector('#table_drag .el-table__body-wrapper tbody')
@@ -177,6 +184,7 @@ export default {
this.query.categoryId = ''
this.query.typeEnum = ''
this.tableData.page = 0
localStorage.setItem('shopIndexQuery', JSON.stringify(this.query))
this.getTableData()
},
// 分页回调
@@ -186,8 +194,13 @@ export default {
},
// 获取商品列表
async getTableData() {
this.tableData.loading = true
try {
let localQuery = JSON.parse(localStorage.getItem('shopIndexQuery'))
if (localQuery != null) {
this.query = localQuery
}
this.tableData.loading = true
const res = await tbProduct({
page: this.tableData.page,
size: this.tableData.size,