|
|
@ -21,7 +21,7 @@ |
|
|
|
<span><em :class="{hide: sorting}" style="font-style: normal">操作</em></span> |
|
|
|
<span><em :class="{hide: sorting}" style="font-style: normal">操作</em></span> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<el-tree :data="listData" node-key="id" default-expand-all :draggable="sorting" :allow-drop="allowDrop"> |
|
|
|
<el-tree :data="list" node-key="id" default-expand-all :draggable="sorting" :allow-drop="allowDrop"> |
|
|
|
<span class="custom-tree-node" slot-scope="{ node, data }"> |
|
|
|
<span class="custom-tree-node" slot-scope="{ node, data }"> |
|
|
|
<span class="name">{{ data.name }}</span> |
|
|
|
<span class="name">{{ data.name }}</span> |
|
|
|
<span class="action" v-show="!sorting"> |
|
|
|
<span class="action" v-show="!sorting"> |
|
|
@ -66,8 +66,8 @@ export default { |
|
|
|
first: "栏目管理" |
|
|
|
first: "栏目管理" |
|
|
|
}, |
|
|
|
}, |
|
|
|
name: this.$store.state.name, |
|
|
|
name: this.$store.state.name, |
|
|
|
originalList: [], |
|
|
|
originList: [], |
|
|
|
listData: [], |
|
|
|
list: [], |
|
|
|
multipleSelection: [], |
|
|
|
multipleSelection: [], |
|
|
|
pageNo: 1, |
|
|
|
pageNo: 1, |
|
|
|
pageSize: 10, |
|
|
|
pageSize: 10, |
|
|
@ -87,20 +87,6 @@ export default { |
|
|
|
mounted() { |
|
|
|
mounted() { |
|
|
|
this.getData(); |
|
|
|
this.getData(); |
|
|
|
}, |
|
|
|
}, |
|
|
|
beforeRouteLeave(to, from, next) { |
|
|
|
|
|
|
|
if (JSON.stringify(this.originalList) !== JSON.stringify(this.listData)) { |
|
|
|
|
|
|
|
this.$confirm("确定返回?排序尚未保存。", "提示", { |
|
|
|
|
|
|
|
type: "warning" |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
.then(() => { |
|
|
|
|
|
|
|
next(); |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
.catch(() => { |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
next(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
methods: { |
|
|
|
methods: { |
|
|
|
getData() { |
|
|
|
getData() { |
|
|
|
this.$get(this.api.queryAllColumns, { |
|
|
|
this.$get(this.api.queryAllColumns, { |
|
|
@ -108,8 +94,8 @@ export default { |
|
|
|
page: this.pageNo, |
|
|
|
page: this.pageNo, |
|
|
|
size: this.pageSize |
|
|
|
size: this.pageSize |
|
|
|
}).then(({ columnTree }) => { |
|
|
|
}).then(({ columnTree }) => { |
|
|
|
this.listData = columnTree |
|
|
|
this.list = columnTree |
|
|
|
this.originalList = JSON.parse(JSON.stringify(this.listData)); |
|
|
|
this.originList = JSON.parse(JSON.stringify(this.list)); |
|
|
|
this.total = columnTree.length |
|
|
|
this.total = columnTree.length |
|
|
|
}).catch(res => { |
|
|
|
}).catch(res => { |
|
|
|
}); |
|
|
|
}); |
|
|
@ -159,7 +145,7 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
sortSubmit() { |
|
|
|
sortSubmit() { |
|
|
|
this.level = 0 |
|
|
|
this.level = 0 |
|
|
|
let list = JSON.parse(JSON.stringify(this.listData)) |
|
|
|
let list = JSON.parse(JSON.stringify(this.list)) |
|
|
|
this.handleList(list) |
|
|
|
this.handleList(list) |
|
|
|
this.$post(this.api.columnReorder, { |
|
|
|
this.$post(this.api.columnReorder, { |
|
|
|
columnTree: list |
|
|
|
columnTree: list |
|
|
@ -191,7 +177,7 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
cancelSort() { |
|
|
|
cancelSort() { |
|
|
|
this.sorting = false; |
|
|
|
this.sorting = false; |
|
|
|
this.listData = JSON.parse(JSON.stringify(this.originalList)); |
|
|
|
this.list = JSON.parse(JSON.stringify(this.originList)); |
|
|
|
this.sortObj.destroy(); |
|
|
|
this.sortObj.destroy(); |
|
|
|
}, |
|
|
|
}, |
|
|
|
openSort() { |
|
|
|
openSort() { |
|
|
|