|
@ -1,11 +1,11 @@ |
|
|
<template> |
|
|
<template> |
|
|
<!--表单组件--> |
|
|
<!--表单组件--> |
|
|
<el-dialog title="排序" :visible.sync="sortVisible" @opened="opened"> |
|
|
|
|
|
|
|
|
<el-dialog :close-on-click-modal="false" title="排序" :visible.sync="sortVisible" @opened="opened"> |
|
|
<span class="dialog-right-top" /> |
|
|
<span class="dialog-right-top" /> |
|
|
<span class="dialog-left-bottom" /> |
|
|
<span class="dialog-left-bottom" /> |
|
|
<div class="setting-dialog"> |
|
|
<div class="setting-dialog"> |
|
|
<i class="drag-tip">提示:请通过拖动鼠标来调整当前顺序</i> |
|
|
<i class="drag-tip">提示:请通过拖动鼠标来调整当前顺序</i> |
|
|
<el-table :data="sortTableData" class="category-sort" style="width: 100%;max-height: 70vh;" row-key="id"> |
|
|
|
|
|
|
|
|
<el-table :data="sortTableData" :tree-props="{children: 'childrens'}" class="category-sort" style="width: 100%;max-height: 70vh;" row-key="id"> |
|
|
<el-table-column type="index" label="序号" width="100" align="center" /> |
|
|
<el-table-column type="index" label="序号" width="100" align="center" /> |
|
|
<el-table-column prop="cnName" label="门类名称" /> |
|
|
<el-table-column prop="cnName" label="门类名称" /> |
|
|
</el-table> |
|
|
</el-table> |
|
@ -18,6 +18,7 @@ |
|
|
|
|
|
|
|
|
<script> |
|
|
<script> |
|
|
import Sortable from 'sortablejs' |
|
|
import Sortable from 'sortablejs' |
|
|
|
|
|
import { sort } from '@/api/category/category' |
|
|
|
|
|
|
|
|
export default { |
|
|
export default { |
|
|
data() { |
|
|
data() { |
|
@ -45,7 +46,16 @@ export default { |
|
|
this.rowDrop('category-sort', 'sortTableData') |
|
|
this.rowDrop('category-sort', 'sortTableData') |
|
|
}, |
|
|
}, |
|
|
handleSort() { |
|
|
handleSort() { |
|
|
|
|
|
|
|
|
|
|
|
const data = this.sortTableData.map((value, index) => { |
|
|
|
|
|
return { id: value.id, sort: index + 1 } |
|
|
|
|
|
}) |
|
|
|
|
|
this.sortTableData.forEach((item, index) => { |
|
|
|
|
|
item.categorySeq = index + 1 |
|
|
|
|
|
}) |
|
|
|
|
|
sort(data).then(() => { |
|
|
|
|
|
this.sortVisible = false |
|
|
|
|
|
this.$emit('treeNodeSort', this.sortTableData) |
|
|
|
|
|
}) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|