添加云南曲靖打包命令修改5层树逻辑
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
<div class="title">角色列表</div>
|
||||
<el-button :icon="Plus" type="primary" @click="addRole" class="ml10">新增</el-button>
|
||||
</div>
|
||||
<Table ref="tableRef" @currentChange="currentChange" />
|
||||
<Table ref="tableRef" :row-config="{ isCurrent: true, isHover: true }" @currentChange="currentChange" />
|
||||
</div>
|
||||
<Tree
|
||||
v-if="menuListId"
|
||||
@@ -13,8 +13,8 @@
|
||||
show-checkbox
|
||||
width="350px"
|
||||
:data="menuTree"
|
||||
:checkStrictly="checkStrictly"
|
||||
@check-change="checkChange"
|
||||
:checkStrictly="false"
|
||||
@checkChange="checkChange"
|
||||
></Tree>
|
||||
<el-empty style="width: 350px; padding-top: 300px; box-sizing: border-box" description="请选择角色" v-else />
|
||||
<PopupForm ref="popupRef"></PopupForm>
|
||||
@@ -26,7 +26,7 @@ import { ref, onMounted, provide } from 'vue'
|
||||
import TableStore from '@/utils/tableStore'
|
||||
import Table from '@/components/table/index.vue'
|
||||
import TableHeader from '@/components/table/header/index.vue'
|
||||
import Tree from '@/components/tree/index.vue'
|
||||
import Tree from '@/components/tree/allocation.vue'
|
||||
import { functionTree } from '@/api/user-boot/function'
|
||||
import { getFunctionsByRoleIndex, updateRoleMenu } from '@/api/user-boot/roleFuction'
|
||||
import { mainHeight } from '@/utils/layout'
|
||||
@@ -37,12 +37,13 @@ import { useAdminInfo } from '@/stores/adminInfo'
|
||||
|
||||
const adminInfo = useAdminInfo()
|
||||
defineOptions({
|
||||
name: 'user-boot/role/list'
|
||||
name: 'auth/role'
|
||||
})
|
||||
const height = mainHeight(20).height
|
||||
const treeRef = ref()
|
||||
const menuTree = ref<treeData[]>([])
|
||||
const popupRef = ref()
|
||||
const tableRef = ref()
|
||||
const checkStrictly = ref(true)
|
||||
const menuListId = ref('')
|
||||
const tableStore = new TableStore({
|
||||
@@ -104,7 +105,13 @@ const tableStore = new TableStore({
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
],
|
||||
loadCallback: () => {
|
||||
tableRef.value.getRef().setCurrentRow(tableStore.table.data[0])
|
||||
currentChange({
|
||||
row: tableStore.table.data[0]
|
||||
})
|
||||
}
|
||||
})
|
||||
tableStore.table.params.searchValue = ''
|
||||
|
||||
@@ -139,21 +146,22 @@ const currentChange = (data: any) => {
|
||||
|
||||
const timeout = ref<NodeJS.Timeout>()
|
||||
const checkChange = (data: any) => {
|
||||
if (checkStrictly.value) {
|
||||
checkStrictly.value = false
|
||||
return
|
||||
}
|
||||
if (timeout.value) {
|
||||
clearTimeout(timeout.value)
|
||||
}
|
||||
timeout.value = setTimeout(() => {
|
||||
updateRoleMenu({
|
||||
id: menuListId.value,
|
||||
idList: treeRef.value.treeRef.getCheckedNodes(false, true).map((node: any) => node.id)
|
||||
}).then(() => {
|
||||
// if (checkStrictly.value) {
|
||||
// checkStrictly.value = false
|
||||
// return
|
||||
// }
|
||||
|
||||
updateRoleMenu({
|
||||
id: menuListId.value,
|
||||
idList: treeRef.value.treeRef.getCheckedNodes(false, true).map((node: any) => node.id)
|
||||
})
|
||||
.then(() => {
|
||||
ElMessage.success('操作成功!')
|
||||
treeRef.value.loading = false
|
||||
})
|
||||
.catch(() => {
|
||||
treeRef.value.loading = false
|
||||
})
|
||||
}, 1000)
|
||||
}
|
||||
onMounted(() => {
|
||||
tableStore.index()
|
||||
@@ -162,8 +170,3 @@ const addRole = () => {
|
||||
popupRef.value.open('新增角色')
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
:deep(.row--current) {
|
||||
// background-color: var(--el-color-primary-light-8) !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user