fix: Resource authorization selection directory checkbox Cancel optimization (#4253)
parent
bc1afb9020
commit
2ecdb66307
|
|
@ -36,7 +36,7 @@
|
||||||
<el-pagination
|
<el-pagination
|
||||||
v-model:current-page="paginationConfig.current_page"
|
v-model:current-page="paginationConfig.current_page"
|
||||||
v-model:page-size="paginationConfig.page_size"
|
v-model:page-size="paginationConfig.page_size"
|
||||||
:page-sizes="paginationConfig.page_sizes|| pageSizes"
|
:page-sizes="paginationConfig.page_sizes || pageSizes"
|
||||||
:total="paginationConfig.total"
|
:total="paginationConfig.total"
|
||||||
layout="total, prev, pager, next, sizes"
|
layout="total, prev, pager, next, sizes"
|
||||||
@size-change="handleSizeChange"
|
@size-change="handleSizeChange"
|
||||||
|
|
@ -138,8 +138,16 @@ function handleCurrentChange() {
|
||||||
function clearSelection() {
|
function clearSelection() {
|
||||||
appTableRef.value?.clearSelection()
|
appTableRef.value?.clearSelection()
|
||||||
}
|
}
|
||||||
|
function toggleRowSelection(row: any, selected?: boolean, ignoreSelectable = true) {
|
||||||
|
appTableRef.value?.toggleRowSelection(row, selected, ignoreSelectable)
|
||||||
|
}
|
||||||
|
function getSelectionRows() {
|
||||||
|
return appTableRef.value?.getSelectionRows()
|
||||||
|
}
|
||||||
defineExpose({
|
defineExpose({
|
||||||
clearSelection,
|
clearSelection,
|
||||||
|
toggleRowSelection,
|
||||||
|
getSelectionRows,
|
||||||
})
|
})
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@
|
||||||
ref="multipleTableRef"
|
ref="multipleTableRef"
|
||||||
class="mt-16"
|
class="mt-16"
|
||||||
:data="filteredData"
|
:data="filteredData"
|
||||||
@selection-change="handleSelectionChange"
|
@select="select"
|
||||||
:maxTableHeight="260"
|
:maxTableHeight="260"
|
||||||
:row-key="(row: any) => row.id"
|
:row-key="(row: any) => row.id"
|
||||||
style="min-width: 600px"
|
style="min-width: 600px"
|
||||||
|
|
@ -147,6 +147,7 @@ import { hasPermission } from '@/utils/permission/index'
|
||||||
import { ComplexPermission } from '@/utils/permission/type'
|
import { ComplexPermission } from '@/utils/permission/type'
|
||||||
import { getPermissionOptions } from '@/views/system/resource-authorization/constant'
|
import { getPermissionOptions } from '@/views/system/resource-authorization/constant'
|
||||||
import useStore from '@/stores'
|
import useStore from '@/stores'
|
||||||
|
import { TreeToFlatten } from '@/utils/array'
|
||||||
|
|
||||||
const { model, user } = useStore()
|
const { model, user } = useStore()
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
|
|
@ -310,11 +311,33 @@ const filteredData = computed(() => {
|
||||||
})
|
})
|
||||||
|
|
||||||
const multipleSelection = ref<any[]>([])
|
const multipleSelection = ref<any[]>([])
|
||||||
|
const selectObj: any = {}
|
||||||
|
const select = (val: any[], active: any) => {
|
||||||
|
if (active.resource_type === 'folder') {
|
||||||
|
if (!val.some((item) => item.id == active.id)) {
|
||||||
|
if (selectObj[active.id] === undefined) {
|
||||||
|
selectObj[active.id] = 0
|
||||||
|
}
|
||||||
|
if (selectObj[active.id] % 2 == 0) {
|
||||||
|
console.log(TreeToFlatten([active]))
|
||||||
|
TreeToFlatten([active])
|
||||||
|
.filter((item: any) => item.id != active.id)
|
||||||
|
.forEach((item: any) => {
|
||||||
|
multipleTableRef.value?.toggleRowSelection(item, true)
|
||||||
|
})
|
||||||
|
|
||||||
const handleSelectionChange = (val: any[]) => {
|
multipleSelection.value = multipleTableRef.value.getSelectionRows()
|
||||||
multipleSelection.value = val
|
} else {
|
||||||
|
multipleSelection.value = val
|
||||||
|
}
|
||||||
|
selectObj[active.id] = selectObj[active.id] + 1
|
||||||
|
} else {
|
||||||
|
multipleSelection.value = val
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
multipleSelection.value = val
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const dialogVisible = ref(false)
|
const dialogVisible = ref(false)
|
||||||
const radioPermission = ref('')
|
const radioPermission = ref('')
|
||||||
function openMulConfigureDialog() {
|
function openMulConfigureDialog() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue