权限编辑增加排序
This commit is contained in:
parent
bbd2d75ace
commit
9cfd62f08b
@ -160,7 +160,7 @@ export default class extends Vue {
|
||||
private total = 0
|
||||
private list: IShopData[] = []
|
||||
private listLoading = true
|
||||
private allDepts = []
|
||||
private allDepts: IShopData[] = []
|
||||
private listQuery = {
|
||||
page: 1,
|
||||
limit: 20,
|
||||
|
@ -22,7 +22,7 @@
|
||||
style="width: 50%"
|
||||
>
|
||||
<el-option
|
||||
v-for="(item, index) in shopListOptions"
|
||||
v-for="(item) in shopListOptions"
|
||||
:key="item.id"
|
||||
:label="item.showStr"
|
||||
:value="item.title"
|
||||
|
@ -565,7 +565,7 @@ export default class extends Vue {
|
||||
return result
|
||||
}
|
||||
|
||||
private tableRowClassName({ row, rowIndex }: {row: any, rowIndex: number}) {
|
||||
private tableRowClassName({ row }: {row: any}) {
|
||||
if (row.level === 1) {
|
||||
return 'shop-row'
|
||||
}
|
||||
|
@ -24,16 +24,20 @@
|
||||
highlight-current
|
||||
default-expand-all
|
||||
:expand-on-click-node="false"
|
||||
draggable
|
||||
:allow-drop="allowDrop"
|
||||
:allow-drag="allowDrag"
|
||||
>
|
||||
<template #default="{node, data}">
|
||||
<span class="custom-tree-node">
|
||||
<span>{{ node.label }}</span>
|
||||
<span v-if="node.level === 2">{{ node.label }}({{data.id}})</span>
|
||||
<span v-if="node.level !== 2">{{ node.label }}</span>
|
||||
<span class="action">
|
||||
<a v-if="node.level === 1"
|
||||
@click="append(data)">
|
||||
增加
|
||||
</a>
|
||||
<a v-if="node.level !== 1 && node.level !== 3"
|
||||
<a v-if="node.level === 2"
|
||||
@click="edit(node, data)">
|
||||
修改
|
||||
</a>
|
||||
@ -139,7 +143,7 @@ export default class extends Vue {
|
||||
private loading = true
|
||||
private dialogType = 'new'
|
||||
private dialogVisible = false
|
||||
private record: ITreeData = { actions: [], id: '', label: '' }
|
||||
private record: ITreeData = { actions: [], id: '', label: '', children: [] }
|
||||
private actions = [
|
||||
'read', 'edit', 'delete'
|
||||
]
|
||||
@ -153,7 +157,8 @@ export default class extends Vue {
|
||||
return {
|
||||
id: '',
|
||||
label: '',
|
||||
actions: []
|
||||
actions: [],
|
||||
children: []
|
||||
}
|
||||
}
|
||||
|
||||
@ -244,11 +249,13 @@ export default class extends Vue {
|
||||
actions: data.children?.map(o => o.label)
|
||||
})
|
||||
}
|
||||
await savePermission({ datas: records })
|
||||
const { data } = await savePermission({ datas: records })
|
||||
console.log(records)
|
||||
const str = `<div>更新权限列表成功</div> <div>保存: ${data.saveCount}</div> <div>删除: ${data.deleteCount}<div/>`
|
||||
this.$notify({
|
||||
title: 'Success',
|
||||
message: '更新权限列表成功',
|
||||
dangerouslyUseHTMLString: true,
|
||||
message: str,
|
||||
type: 'success',
|
||||
duration: 2000
|
||||
})
|
||||
@ -263,7 +270,8 @@ export default class extends Vue {
|
||||
this.typeOptions.push({
|
||||
id: 'root',
|
||||
label: 'Root',
|
||||
children: data
|
||||
children: data,
|
||||
actions: []
|
||||
})
|
||||
}
|
||||
|
||||
@ -299,6 +307,20 @@ export default class extends Vue {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// begin of tree drag
|
||||
private allowDrop(draggingNode, dropNode, type) {
|
||||
if (type === 'inner') {
|
||||
return dropNode.level === 1
|
||||
} else {
|
||||
return dropNode.level === 2
|
||||
}
|
||||
}
|
||||
|
||||
private allowDrag(draggingNode) {
|
||||
return draggingNode.level === 2
|
||||
}
|
||||
// end of tree drag
|
||||
}
|
||||
</script>
|
||||
|
||||
|
@ -154,7 +154,7 @@ const defaultRole: IRole = {
|
||||
key: '',
|
||||
name: '',
|
||||
comment: '',
|
||||
permissions: [],
|
||||
permissions: []
|
||||
}
|
||||
|
||||
@Component({
|
||||
|
Loading…
x
Reference in New Issue
Block a user