|
|
@@ -56,9 +56,20 @@
|
|
|
<!-- <el-table-column prop="type" label="套餐类型" :formatter="typeFormatter"> </el-table-column> -->
|
|
|
<el-table-column prop="categoryName" label="套餐类型"> </el-table-column>
|
|
|
<el-table-column label="操作" align="center" fixed="right" min-width="150">
|
|
|
- <template slot-scope="{ row }">
|
|
|
+ <template slot-scope="{ row, $index }">
|
|
|
+ <el-button @click="move($index, -1)" :disabled="$index == 0" type="success" size="mini" plain
|
|
|
+ >上移</el-button
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ @click="move($index, 1)"
|
|
|
+ :disabled="(page - 1) * pageSize + $index == totalElements - 1"
|
|
|
+ type="warning"
|
|
|
+ size="mini"
|
|
|
+ plain
|
|
|
+ >下移</el-button
|
|
|
+ >
|
|
|
<el-button @click="editRow(row)" type="primary" size="mini" plain>编辑</el-button>
|
|
|
- <el-button @click="deleteRow(row)" type="danger" size="mini" plain>删除</el-button>
|
|
|
+ <!-- <el-button @click="deleteRow(row)" type="danger" size="mini" plain>删除</el-button> -->
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
@@ -151,7 +162,7 @@ export default {
|
|
|
// attractionsId: this.attractionsId
|
|
|
// }
|
|
|
// };
|
|
|
- let data = { query: {} };
|
|
|
+ let data = { sort: 'sort,desc', query: {} };
|
|
|
if (this.search) {
|
|
|
data.search = this.search;
|
|
|
}
|
|
|
@@ -240,6 +251,40 @@ export default {
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
+ },
|
|
|
+ move(index, direction) {
|
|
|
+ const start = index;
|
|
|
+ const end = direction + index;
|
|
|
+ const startInfo = { ...this.tableData[start] };
|
|
|
+ const endInfo = { ...this.tableData[end] };
|
|
|
+ Promise.all([
|
|
|
+ this.$http.post(
|
|
|
+ '/package/save',
|
|
|
+ {
|
|
|
+ ...startInfo,
|
|
|
+ sort: endInfo.sort
|
|
|
+ },
|
|
|
+ { body: 'json' }
|
|
|
+ ),
|
|
|
+ this.$http.post(
|
|
|
+ '/package/save',
|
|
|
+ {
|
|
|
+ ...endInfo,
|
|
|
+ sort: startInfo.sort
|
|
|
+ },
|
|
|
+ { body: 'json' }
|
|
|
+ )
|
|
|
+ ])
|
|
|
+ .then(_ => {
|
|
|
+ this.loading = false;
|
|
|
+ this.getData();
|
|
|
+ this.$message.success('成功');
|
|
|
+ })
|
|
|
+ .catch(e => {
|
|
|
+ console.log(e);
|
|
|
+ this.loading = false;
|
|
|
+ this.$message.error(e.error);
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
};
|