first commit
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,65 @@
|
||||
const sort_component = {
|
||||
template: `
|
||||
<el-dialog title="排序" :visible.sync="sortDialogVisible" width="50%">
|
||||
<el-tree ref="sortTreeRef" :data="sortData" draggable :allow-drop="sortAllowDrop" node-key="id"
|
||||
style="height: 60vh;overflow-y: auto"
|
||||
:props="defaultProps">
|
||||
<span class="custom-tree-node" slot-scope="scope">
|
||||
<span>{{ scope.node.label }}</span>
|
||||
</span>
|
||||
</el-tree>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="sortDialogVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="doSort">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
`,
|
||||
data() {
|
||||
return {
|
||||
sortDialogVisible: false,
|
||||
sortData: [],
|
||||
defaultProps: {
|
||||
children: "children",
|
||||
label: "name"
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onOpen() {
|
||||
this.sortDialogVisible = true
|
||||
this.$axios.post("/platform/sys/role/sortData").then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.sortData = res.data
|
||||
}
|
||||
})
|
||||
},
|
||||
sortAllowDrop(moveNode, inNode, type) {
|
||||
return type !== "inner"
|
||||
},
|
||||
doSort() {
|
||||
const loading = this.$loading({
|
||||
lock: true,
|
||||
text: "正在提交...",
|
||||
spinner: "el-icon-loading"
|
||||
})
|
||||
const afterSorts = this.sortData.map((v) => {
|
||||
return {
|
||||
id: v.id,
|
||||
name: v.name
|
||||
}
|
||||
})
|
||||
this.$axios
|
||||
.post("/platform/sys/role/doSort", { roles: JSON.stringify(afterSorts) })
|
||||
.then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.$message.success(res.msg)
|
||||
this.sortDialogVisible = false
|
||||
this.$emit("refresh", null)
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
loading.close()
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user