|
@@ -54,7 +54,7 @@
|
|
|
<el-tree
|
|
|
ref="treeRef"
|
|
|
style="max-width: 600px"
|
|
|
- :data="data"
|
|
|
+ :data="roleTreedata"
|
|
|
show-checkbox
|
|
|
default-expand-all
|
|
|
node-key="id"
|
|
@@ -67,7 +67,7 @@
|
|
|
<script setup>
|
|
|
import { onMounted, ref, watch } from 'vue'
|
|
|
import { HcDelMsg } from 'hc-vue3-ui'
|
|
|
- import { getList, getRoleTree, remove } from '~api/system/role.js'
|
|
|
+ import { getList, grantTree, remove } from '~api/system/role.js'
|
|
|
import { arrToId, formValidate, getArrValue, getObjValue } from 'js-fast-way'
|
|
|
onMounted(()=>{
|
|
|
getTableData()
|
|
@@ -85,6 +85,7 @@
|
|
|
const addModal = ref(false)
|
|
|
const addClick = ()=>{
|
|
|
addModal.value = true
|
|
|
+ getRoleTreedata()
|
|
|
}
|
|
|
const baseForm = ref({
|
|
|
roleName:'' })
|
|
@@ -165,59 +166,20 @@ const removeRole = async (ids) => {
|
|
|
|
|
|
const defaultProps = {
|
|
|
children: 'children',
|
|
|
- label: 'label',
|
|
|
+ label: 'title',
|
|
|
}
|
|
|
|
|
|
-const data = [
|
|
|
- {
|
|
|
- id: 1,
|
|
|
- label: 'Level one 1',
|
|
|
- children: [
|
|
|
- {
|
|
|
- id: 4,
|
|
|
- label: 'Level two 1-1',
|
|
|
- children: [
|
|
|
- {
|
|
|
- id: 9,
|
|
|
- label: 'Level three 1-1-1',
|
|
|
- },
|
|
|
- {
|
|
|
- id: 10,
|
|
|
- label: 'Level three 1-1-2',
|
|
|
- },
|
|
|
- ],
|
|
|
- },
|
|
|
- ],
|
|
|
- },
|
|
|
- {
|
|
|
- id: 2,
|
|
|
- label: 'Level one 2',
|
|
|
- children: [
|
|
|
- {
|
|
|
- id: 5,
|
|
|
- label: 'Level two 2-1',
|
|
|
- },
|
|
|
- {
|
|
|
- id: 6,
|
|
|
- label: 'Level two 2-2',
|
|
|
- },
|
|
|
- ],
|
|
|
- },
|
|
|
- {
|
|
|
- id: 3,
|
|
|
- label: 'Level one 3',
|
|
|
- children: [
|
|
|
- {
|
|
|
- id: 7,
|
|
|
- label: 'Level two 3-1',
|
|
|
- },
|
|
|
- {
|
|
|
- id: 8,
|
|
|
- label: 'Level two 3-2',
|
|
|
- },
|
|
|
- ],
|
|
|
- },
|
|
|
-]
|
|
|
+const roleTreedata = ref([])
|
|
|
+const getRoleTreedata = async () => {
|
|
|
+ const { error, code, data } = await grantTree()
|
|
|
+ if (!error && code === 200) {
|
|
|
+ roleTreedata.value = getArrValue(data)
|
|
|
+ } else {
|
|
|
+ roleTreedata.value = []
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<style lang='scss' scoped>
|