Merge branch 'feature/1.7-cxx' into 'main'

feature/1.7-MCP

See merge request apipark/APIPark!311
This commit is contained in:
lichunxian
2025-04-14 11:12:24 +08:00
3 changed files with 56 additions and 12 deletions
@@ -85,7 +85,7 @@ export const SYSTEM_TABLE_COLUMNS: PageProColumns<SystemTableListItem>[] = [
title: '服务名称',
dataIndex: 'name',
ellipsis: true,
width: 160,
width: 220,
fixed: 'left',
sorter: (a, b) => {
return a.name.localeCompare(b.name)
@@ -100,24 +100,20 @@ export const SYSTEM_TABLE_COLUMNS: PageProColumns<SystemTableListItem>[] = [
{
title: '类型',
dataIndex: 'service_kind',
width: 140,
width: 100,
ellipsis: true
},
{
title: '所属团队',
dataIndex: ['team', 'name'],
ellipsis: true
},
{
title: '状态',
width: 140,
dataIndex: 'state',
ellipsis: true
ellipsis: true,
width: 200
},
{
title: 'API 数量',
dataIndex: 'apiNum',
ellipsis: true,
width: 140,
sorter: (a, b) => {
return a.apiNum - b.apiNum
}
+32
View File
@@ -1213,6 +1213,38 @@ p{
display: none;
}
/* 将折叠图标移到右侧 */
.service-hub-custom-switcher .ant-tree-switcher {
position: absolute !important;
right: 0 !important;
left: auto !important;
z-index: 10 !important;
}
/* 设置节点内容宽度 */
.service-hub-custom-switcher .ant-tree-node-content-wrapper {
width: calc(100% - 24px) !important;
padding-left: 8px !important;
padding-right: 24px !important;
box-sizing: border-box !important;
}
/* 强制控制标题元素的样式 */
.service-hub-custom-switcher .ant-tree-title {
display: inline-block !important;
width: calc(100% - 10px) !important;
overflow: hidden !important;
white-space: nowrap !important;
text-overflow: ellipsis !important;
vertical-align: middle !important;
}
/* 确保选中框的间距 */
.service-hub-custom-switcher .ant-tree-checkbox {
margin-right: 8px !important;
}
.no-selected-tree .ant-tree-node-selected{
background-color: transparent !important;
}
@@ -39,6 +39,20 @@ export const ServiceHubGroup = ({ children, filterOption, dispatch }: ServiceHub
dispatch({ type: SERVICE_HUB_LIST_ACTIONS.LIST_LOADING, payload: false })
}
// 递归获取所有分类ID(包括子分类)
const getAllCategoryIds = (categories: CategorizesType[]): string[] => {
let ids: string[] = []
categories.forEach((category) => {
// 添加当前分类ID
ids.push(category.id)
// 如果有子分类,递归获取子分类ID
if (category.children && category.children.length > 0) {
ids = [...ids, ...getAllCategoryIds(category.children)]
}
})
return ids
}
const getTagAndServiceClassifyList = () => {
fetchData<BasicResponse<{ catalogues: CategorizesType[]; tags: EntityItem[] }>>('catalogues', {
method: 'GET'
@@ -50,9 +64,11 @@ export const ServiceHubGroup = ({ children, filterOption, dispatch }: ServiceHub
type: SERVICE_HUB_LIST_ACTIONS.GET_TAGS,
payload: [...data.tags, { id: 'empty', name: $t('无标签') }]
})
// 使用递归函数获取所有分类ID
const allCategoryIds = getAllCategoryIds(data.catalogues)
dispatch({
type: SERVICE_HUB_LIST_ACTIONS.SET_SELECTED_CATE,
payload: [...data.catalogues.map((x: CategorizesType) => x.id)]
payload: allCategoryIds
})
dispatch({
type: SERVICE_HUB_LIST_ACTIONS.SET_SELECTED_TAG,
@@ -116,7 +132,7 @@ export const ServiceHubGroup = ({ children, filterOption, dispatch }: ServiceHub
<div className="mt-[20px] ml-[20px] pr-[10px] ">
<p className="text-[18px] h-[25px] leading-[25px] font-bold mb-[15px]">{$t('分类')}</p>
<Tree
className={`no-selected-tree ${transferToTreeData(filterOption.categoriesList).filter((x) => x.children && x.children.length > 0).length > 0 ? '' : 'no-first-switch-tree'}`}
className={`no-selected-tree service-hub-custom-switcher ${transferToTreeData(filterOption.categoriesList).filter((x) => x.children && x.children.length > 0).length > 0 ? '' : 'no-first-switch-tree'}`}
checkable
blockNode={true}
checkedKeys={filterOption.selectedCate}
@@ -130,7 +146,7 @@ export const ServiceHubGroup = ({ children, filterOption, dispatch }: ServiceHub
<div className="ml-[20px] pr-[10px]">
<p className="text-[18px] h-[25px] leading-[25px] font-bold mb-[15px]">{$t('标签')}</p>
<Tree
className="no-first-switch-tree no-selected-tree"
className="no-first-switch-tree no-selected-tree service-hub-custom-switcher"
checkable
blockNode={true}
checkedKeys={filterOption.selectedTag}