From b2313b75bd298026d5dc47e4957266ecb612a197 Mon Sep 17 00:00:00 2001 From: hrx <18603305412@163.com> Date: Mon, 22 Jun 2026 14:53:50 +0800 Subject: [PATCH] bug --- .../views/operation/modelInfoConfig/index.vue | 135 ++++++++++++++---- 1 file changed, 111 insertions(+), 24 deletions(-) diff --git a/f/web-kboss/src/views/operation/modelInfoConfig/index.vue b/f/web-kboss/src/views/operation/modelInfoConfig/index.vue index 5a07081..b04a513 100644 --- a/f/web-kboss/src/views/operation/modelInfoConfig/index.vue +++ b/f/web-kboss/src/views/operation/modelInfoConfig/index.vue @@ -10,28 +10,45 @@ v-model="queryForm.modelName" size="small" clearable - placeholder="搜索模型名称" + placeholder="搜索模型/接口/描述" + @keyup.enter.native="handleSearch" + @clear="handleSearch" > - + - - - + - + - - - + - 查询 - 重置 + 查询 + 重置 添加 @@ -39,7 +56,7 @@
- + @@ -68,12 +85,16 @@
@@ -100,13 +121,47 @@ export default { modelType: '', provider: '' }, - tableData: [] + tableData: [], + modelTypeOptions: [], + providerOptions: [], + currentPage: 1, + pageSize: 10 } }, computed: { - displayTableData() { + filteredTableData() { const targetStatus = this.activeTab === 'listed' ? 1 : 0 - return this.tableData.filter(item => Number(item.listing_status || 0) === targetStatus) + const modelName = this.normalizeSearchText(this.queryForm.modelName) + const modelType = this.normalizeSearchText(this.queryForm.modelType) + const provider = this.normalizeSearchText(this.queryForm.provider) + + return this.tableData.filter(item => { + if (Number(item.listing_status || 0) !== targetStatus) return false + + const apiDoc = item.api_doc || {} + const nameText = this.normalizeSearchText([ + item.model_name, + item.display_name, + item.llmid, + item.id, + item.description, + apiDoc.api_url, + apiDoc.curl_code, + apiDoc.python_code + ].join(' ')) + const typeText = this.normalizeSearchText(item.model_type) + const providerText = this.normalizeSearchText(item.provider) + + const nameMatched = !modelName || nameText.includes(modelName) + const typeMatched = !modelType || typeText === modelType || typeText.includes(modelType) + const providerMatched = !provider || providerText === provider + + return nameMatched && typeMatched && providerMatched + }) + }, + displayTableData() { + const start = (this.currentPage - 1) * this.pageSize + return this.filteredTableData.slice(start, start + this.pageSize) } }, created() { @@ -115,13 +170,45 @@ export default { methods: { // 获取模型信息配置列表 async getModelInfoConfigList() { - const res = await reqModelInfoConfigList() + const res = await reqModelInfoConfigList({ + current_page: 1, + page_size: 1000 + }) console.log(res); if (res.status === true) { - this.tableData = res.data.model_list + const data = res.data || {} + this.tableData = Array.isArray(data.model_list) ? data.model_list : [] + this.providerOptions = Array.isArray(data.provider_list) ? data.provider_list.filter(Boolean) : [] + this.modelTypeOptions = Array.isArray(data.model_type_list) ? data.model_type_list.filter(Boolean) : [] + this.currentPage = 1 } }, + normalizeSearchText(value) { + return String(value || '').trim().toLowerCase() + }, + handleSearch() { + this.currentPage = 1 + }, + resetQuery() { + this.queryForm = { + modelName: '', + modelType: '', + provider: '' + } + this.currentPage = 1 + this.getModelInfoConfigList() + }, + handleTabChange() { + this.currentPage = 1 + }, + handleSizeChange(size) { + this.pageSize = size + this.currentPage = 1 + }, + handleCurrentChange(page) { + this.currentPage = page + }, openAddDialog() { this.$refs.editDialog.open() @@ -238,7 +325,7 @@ export default { .table-footer { display: flex; align-items: center; - justify-content: space-between; + justify-content: flex-end; padding: 12px 0 0; color: #667085; font-size: 13px;