refactor: update parameter initialization in getList functions for improved clarity

--bug=1058075 --user=刘瑞斌 【知识库】社区版、企业版、专业版搜索框切换完搜索字段后点击知识库文件夹提示必须是一个有效的uuid https://www.tapd.cn/62980211/s/1723617
This commit is contained in:
CaptainB 2025-07-04 15:43:04 +08:00
parent ad19518108
commit d7b4f90798
9 changed files with 28 additions and 17 deletions

View File

@ -551,7 +551,7 @@ class ToolTreeSerializer(serializers.Serializer):
name = serializers.CharField(required=False, allow_null=True, allow_blank=True, label=_('tool name'))
user_id = serializers.UUIDField(required=False, allow_null=True, label=_('user id'))
scope = serializers.CharField(required=True, label=_('scope'))
create_user = serializers.UUIDField(required=False, label=_('scope'), allow_null=True)
create_user = serializers.UUIDField(required=False, label=_('create user'), allow_null=True)
def page_tool(self, current_page: int, page_size: int):
self.is_valid(raise_exception=True)

View File

@ -530,9 +530,11 @@ function searchHandle() {
}
function getList() {
const params = {
const params: any = {
folder_id: folder.currentFolder?.id || 'default',
[search_type.value]: search_form.value[search_type.value],
}
if (search_form.value[search_type.value]) {
params[search_type.value] = search_form.value[search_type.value]
}
ApplicationApi.getApplication(paginationConfig, params, loading).then((res) => {
paginationConfig.total = res.data.total

View File

@ -503,10 +503,12 @@ watch(
)
function getList() {
const params = {
const params: any = {
folder_id: folder.currentFolder?.id || user.getWorkspaceId(),
scope: apiType.value === 'systemShare' ? 'SHARED' : 'WORKSPACE',
[search_type.value]: search_form.value[search_type.value],
}
if (search_form.value[search_type.value]) {
params[search_type.value] = search_form.value[search_type.value]
}
loadSharedApi({ type: 'knowledge', isShared: isShared.value, systemType: apiType.value })
.getKnowledgeListPage(paginationConfig, params, loading)

View File

@ -298,8 +298,9 @@ const paginationConfig = reactive({
const userTableData = ref<ChatUserItem[]>([])
function getList() {
const params = {
[search_type.value]: search_form.value[search_type.value as keyof typeof search_form.value],
const params: any = {}
if (search_form.value[search_type.value as keyof typeof search_form.value]) {
params[search_type.value] = search_form.value[search_type.value as keyof typeof search_form.value]
}
return loadPermissionApi('chatUser').getUserManage(paginationConfig, params, loading).then((res: any) => {
userTableData.value = res.data.records

View File

@ -301,8 +301,9 @@ const search_type_change = () => {
}
function getList() {
const params = {
[search_type.value]: search_form.value[search_type.value],
const params: any = {}
if (search_form.value[search_type.value]) {
params[search_type.value] = search_form.value[search_type.value]
}
if (workspaceArr.value.length > 0) {
params['workspace_ids'] = JSON.stringify(workspaceArr.value)

View File

@ -192,8 +192,9 @@ const search_type_change = () => {
}
function getList() {
const params = {
[search_type.value]: search_form.value[search_type.value],
const params: any = {}
if (search_form.value[search_type.value]) {
params[search_type.value] = search_form.value[search_type.value]
}
if (workspaceArr.value.length > 0) {
params.workspace_ids = JSON.stringify(workspaceArr.value)

View File

@ -214,8 +214,9 @@ const search_type_change = () => {
}
function getList() {
const params = {
[search_type.value]: search_form.value[search_type.value],
const params: any = {}
if (search_form.value[search_type.value]) {
params[search_type.value] = search_form.value[search_type.value]
}
if (workspaceArr.value.length > 0) {
params.workspace_ids = JSON.stringify(workspaceArr.value)

View File

@ -250,8 +250,9 @@ function handleSizeChange() {
}
function getList() {
const params = {
[search_type.value]: search_form.value[search_type.value as keyof typeof search_form.value],
const params: any = {}
if (search_form.value[search_type.value as keyof typeof search_form.value]) {
params[search_type.value] = search_form.value[search_type.value as keyof typeof search_form.value]
}
return userManageApi.getUserManage(paginationConfig, params, loading).then((res) => {
userTableData.value = res.data.records.map((item: any) => ({

View File

@ -606,11 +606,13 @@ watch(
{ deep: true, immediate: true },
)
function getList() {
const params = {
[search_type.value]: search_form.value[search_type.value],
const params: any = {
folder_id: folder.currentFolder?.id || user.getWorkspaceId(),
scope: apiType.value === 'systemShare' ? 'SHARED' : 'WORKSPACE',
}
if (search_form.value[search_type.value]) {
params[search_type.value] = search_form.value[search_type.value]
}
loadSharedApi({ type: 'tool', isShared: isShared.value, systemType: apiType.value })
.getToolListPage(paginationConfig, params, loading)
.then((res: any) => {