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