refactor: improve code formatting and update API call for workspace list

v3.2
wxg0103 2025-07-02 18:38:41 +08:00
parent b011cd7d26
commit 75f75f0111
1 changed files with 10 additions and 6 deletions

View File

@ -72,7 +72,9 @@
<span class="ml-4 lighter">{{ ele.name }}</span> <span class="ml-4 lighter">{{ ele.name }}</span>
</div> </div>
<el-button link> <el-button link>
<el-icon @click="clearWorkspace(ele)" :size="18"><Close /></el-icon> <el-icon @click="clearWorkspace(ele)" :size="18">
<Close/>
</el-icon>
</el-button> </el-button>
</div> </div>
</template> </template>
@ -81,16 +83,18 @@
<template #footer> <template #footer>
<el-button @click="centerDialogVisible = false"> {{ $t('common.cancel') }}</el-button> <el-button @click="centerDialogVisible = false"> {{ $t('common.cancel') }}</el-button>
<el-button type="primary" @click="handleConfirm"> {{ $t('common.add') }} </el-button> <el-button type="primary" @click="handleConfirm"> {{ $t('common.add') }}</el-button>
</template> </template>
</el-dialog> </el-dialog>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, computed } from 'vue' import {ref, computed} from 'vue'
import type { CheckboxValueType } from 'element-plus' import type {CheckboxValueType} from 'element-plus'
import authorizationApi from '@/api/system-shared/authorization' import authorizationApi from '@/api/system-shared/authorization'
import workspaceApi from '@/api/workspace/workspace' import workspaceApi from '@/api/workspace/workspace'
import {loadPermissionApi} from "@/utils/dynamics-api/permission-api.ts";
const checkAll = ref(false) const checkAll = ref(false)
const isIndeterminate = ref(true) const isIndeterminate = ref(true)
const checkedWorkspace = ref<any[]>([]) const checkedWorkspace = ref<any[]>([])
@ -118,13 +122,13 @@ const handleCheckedWorkspaceChange = (value: CheckboxValueType[]) => {
isIndeterminate.value = checkedCount > 0 && checkedCount < workspace.value.length isIndeterminate.value = checkedCount > 0 && checkedCount < workspace.value.length
} }
const open = async ({ id }: any, type = 'Knowledge') => { const open = async ({id}: any, type = 'Knowledge') => {
knowledge_id = id knowledge_id = id
loading.value = true loading.value = true
currentType = type currentType = type
const [authList, systemWorkspaceList] = await Promise.all([ const [authList, systemWorkspaceList] = await Promise.all([
authorizationApi[`getSharedAuthorization${type}`](id), authorizationApi[`getSharedAuthorization${type}`](id),
workspaceApi.getSystemWorkspaceList(), loadPermissionApi('workspace').getSystemWorkspaceList(),
]) ])
workspace.value = systemWorkspaceList.data as any workspace.value = systemWorkspaceList.data as any
listType.value = (authList.data || {}).authentication_type || 'WHITE_LIST' listType.value = (authList.data || {}).authentication_type || 'WHITE_LIST'