diff --git a/frontend/packages/core/src/const/system/const.tsx b/frontend/packages/core/src/const/system/const.tsx index b7dee443..4a84bbad 100644 --- a/frontend/packages/core/src/const/system/const.tsx +++ b/frontend/packages/core/src/const/system/const.tsx @@ -85,7 +85,7 @@ export const SYSTEM_TABLE_COLUMNS: PageProColumns[] = [ 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[] = [ { 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 } diff --git a/frontend/packages/core/src/index.css b/frontend/packages/core/src/index.css index 2f4ae252..d5120f41 100644 --- a/frontend/packages/core/src/index.css +++ b/frontend/packages/core/src/index.css @@ -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; } diff --git a/frontend/packages/market/src/pages/serviceHub/ServiceHubGroup.tsx b/frontend/packages/market/src/pages/serviceHub/ServiceHubGroup.tsx index dded57cb..ad228af3 100644 --- a/frontend/packages/market/src/pages/serviceHub/ServiceHubGroup.tsx +++ b/frontend/packages/market/src/pages/serviceHub/ServiceHubGroup.tsx @@ -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>('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

{$t('分类')}

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

{$t('标签')}