mirror of
https://gh-proxy.org/https://github.com/klinsmaya/SQLBot.git
synced 2026-11-08 01:06:59 +08:00
fix(Permission Configuration): Configure restricted users, search for non-existent users, and cannot clear or delete a single user.
This commit is contained in:
@@ -111,7 +111,9 @@ const workspaceWithKeywords = computed(() => {
|
||||
|
||||
watch(search, () => {
|
||||
const tableNameArr = workspaceWithKeywords.value.map((ele: any) => ele.name)
|
||||
checkedWorkspace.value = checkTableList.value.filter((ele) => tableNameArr.includes(ele.name))
|
||||
checkedWorkspace.value = checkTableList.value.filter((ele: any) =>
|
||||
tableNameArr.includes(ele.name)
|
||||
)
|
||||
const checkedCount = checkedWorkspace.value.length
|
||||
checkAll.value = checkedCount === workspaceWithKeywords.value.length
|
||||
isIndeterminate.value = checkedCount > 0 && checkedCount < workspaceWithKeywords.value.length
|
||||
@@ -122,7 +124,7 @@ const handleCheckAllChange = (val: CheckboxValueType) => {
|
||||
? [
|
||||
...new Set([
|
||||
...workspaceWithKeywords.value,
|
||||
...checkedWorkspace.value.filter((ele) => !tableNameArr.includes(ele.name)),
|
||||
...checkedWorkspace.value.filter((ele: any) => !tableNameArr.includes(ele.name)),
|
||||
]),
|
||||
]
|
||||
: []
|
||||
@@ -131,10 +133,10 @@ const handleCheckAllChange = (val: CheckboxValueType) => {
|
||||
? [
|
||||
...new Set([
|
||||
...workspaceWithKeywords.value,
|
||||
...checkTableList.value.filter((ele) => !tableNameArr.includes(ele.name)),
|
||||
...checkTableList.value.filter((ele: any) => !tableNameArr.includes(ele.name)),
|
||||
]),
|
||||
]
|
||||
: checkTableList.value.filter((ele) => !tableNameArr.includes(ele.name))
|
||||
: checkTableList.value.filter((ele: any) => !tableNameArr.includes(ele.name))
|
||||
}
|
||||
const handleCheckedWorkspaceChange = (value: CheckboxValueType[]) => {
|
||||
const checkedCount = value.length
|
||||
@@ -143,7 +145,7 @@ const handleCheckedWorkspaceChange = (value: CheckboxValueType[]) => {
|
||||
const tableNameArr = workspaceWithKeywords.value.map((ele: any) => ele.name)
|
||||
checkTableList.value = [
|
||||
...new Set([
|
||||
...checkTableList.value.filter((ele) => !tableNameArr.includes(ele.name)),
|
||||
...checkTableList.value.filter((ele: any) => !tableNameArr.includes(ele.name)),
|
||||
...value,
|
||||
]),
|
||||
]
|
||||
@@ -159,7 +161,7 @@ const open = async (user: any) => {
|
||||
const systemWorkspaceList = await workspaceUserList({}, 1, 1000)
|
||||
workspace.value = systemWorkspaceList.items as any
|
||||
if (user?.length) {
|
||||
checkedWorkspace.value = workspace.value.filter((ele) => user.includes(ele.id))
|
||||
checkedWorkspace.value = workspace.value.filter((ele: any) => user.includes(ele.id))
|
||||
checkTableList.value = [...checkedWorkspace.value]
|
||||
handleCheckedWorkspaceChange(checkedWorkspace.value)
|
||||
}
|
||||
@@ -169,6 +171,7 @@ const open = async (user: any) => {
|
||||
|
||||
const clearWorkspace = (val: any) => {
|
||||
checkedWorkspace.value = checkedWorkspace.value.filter((ele: any) => ele.id !== val.id)
|
||||
checkTableList.value = checkTableList.value.filter((ele: any) => ele.id !== val.id)
|
||||
handleCheckedWorkspaceChange(checkedWorkspace.value)
|
||||
}
|
||||
|
||||
@@ -179,7 +182,7 @@ const clearWorkspaceAll = () => {
|
||||
|
||||
defineExpose({
|
||||
open,
|
||||
checkedWorkspace,
|
||||
checkTableList,
|
||||
})
|
||||
</script>
|
||||
<style lang="less">
|
||||
|
||||
@@ -438,7 +438,7 @@ const saveHandler = () => {
|
||||
})
|
||||
}
|
||||
const preview = () => {
|
||||
currentPermission.user = selectPermissionRef.value.checkedWorkspace.map((ele: any) => ele.id)
|
||||
currentPermission.user = selectPermissionRef.value.checkTableList.map((ele: any) => ele.id)
|
||||
activeStep.value = 0
|
||||
}
|
||||
const next = () => {
|
||||
@@ -479,7 +479,7 @@ const save = () => {
|
||||
permissions: permissionsObj,
|
||||
users:
|
||||
isCreate.value || activeStep.value === 1
|
||||
? selectPermissionRef.value.checkedWorkspace.map((ele: any) => ele.id)
|
||||
? selectPermissionRef.value.checkTableList.map((ele: any) => ele.id)
|
||||
: users,
|
||||
}
|
||||
if (!id) {
|
||||
|
||||
@@ -137,7 +137,9 @@ const workspaceWithKeywords = computed(() => {
|
||||
})
|
||||
watch(search, () => {
|
||||
const tableNameArr = workspaceWithKeywords.value.map((ele: any) => ele.name)
|
||||
checkedWorkspace.value = checkTableList.value.filter((ele) => tableNameArr.includes(ele.name))
|
||||
checkedWorkspace.value = checkTableList.value.filter((ele: any) =>
|
||||
tableNameArr.includes(ele.name)
|
||||
)
|
||||
const checkedCount = checkedWorkspace.value.length
|
||||
checkAll.value = checkedCount === workspaceWithKeywords.value.length
|
||||
isIndeterminate.value = checkedCount > 0 && checkedCount < workspaceWithKeywords.value.length
|
||||
@@ -148,7 +150,7 @@ const handleCheckAllChange = (val: CheckboxValueType) => {
|
||||
? [
|
||||
...new Set([
|
||||
...workspaceWithKeywords.value,
|
||||
...checkedWorkspace.value.filter((ele) => !tableNameArr.includes(ele.name)),
|
||||
...checkedWorkspace.value.filter((ele: any) => !tableNameArr.includes(ele.name)),
|
||||
]),
|
||||
]
|
||||
: []
|
||||
@@ -157,10 +159,10 @@ const handleCheckAllChange = (val: CheckboxValueType) => {
|
||||
? [
|
||||
...new Set([
|
||||
...workspaceWithKeywords.value,
|
||||
...checkTableList.value.filter((ele) => !tableNameArr.includes(ele.name)),
|
||||
...checkTableList.value.filter((ele: any) => !tableNameArr.includes(ele.name)),
|
||||
]),
|
||||
]
|
||||
: checkTableList.value.filter((ele) => !tableNameArr.includes(ele.name))
|
||||
: checkTableList.value.filter((ele: any) => !tableNameArr.includes(ele.name))
|
||||
}
|
||||
const handleCheckedWorkspaceChange = (value: CheckboxValueType[]) => {
|
||||
const checkedCount = value.length
|
||||
@@ -169,7 +171,7 @@ const handleCheckedWorkspaceChange = (value: CheckboxValueType[]) => {
|
||||
const tableNameArr = workspaceWithKeywords.value.map((ele: any) => ele.name)
|
||||
checkTableList.value = [
|
||||
...new Set([
|
||||
...checkTableList.value.filter((ele) => !tableNameArr.includes(ele.name)),
|
||||
...checkTableList.value.filter((ele: any) => !tableNameArr.includes(ele.name)),
|
||||
...value,
|
||||
]),
|
||||
]
|
||||
@@ -192,7 +194,7 @@ const open = async (id: any) => {
|
||||
const emits = defineEmits(['refresh'])
|
||||
const handleConfirm = () => {
|
||||
workspaceUwsCreate({
|
||||
uid_list: checkedWorkspace.value.map((ele: any) => ele.id),
|
||||
uid_list: checkTableList.value.map((ele: any) => ele.id),
|
||||
oid,
|
||||
weight: listType.value,
|
||||
}).then(() => {
|
||||
@@ -203,6 +205,7 @@ const handleConfirm = () => {
|
||||
|
||||
const clearWorkspace = (val: any) => {
|
||||
checkedWorkspace.value = checkedWorkspace.value.filter((ele: any) => ele.id !== val.id)
|
||||
checkTableList.value = checkTableList.value.filter((ele: any) => ele.id !== val.id)
|
||||
handleCheckedWorkspaceChange(checkedWorkspace.value)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user