'pages.searchTable.batchDeletion': 'bacth deletion',
'pages.searchTable.batchApproval': 'batch approval',
'pages.header.search.placeholder':'Search service name',
+ 'pages.service.title':'search service',
+ 'pages.service.searchresult.table.title':'search result',
+ 'pages.service.searchresult.column.servicename':'name',
+ 'pages.service.searchresult.column.servicename.tip':'service name is unique',
+ 'pages.service.searchresult.column.groupname':'group',
+ 'pages.service.searchresult.column.version':'version',
+ 'pages.service.searchresult.column.appname':'name',
+ 'pages.common.button.detail':'detail',
};
'pages.searchTable.batchDeletion': '批量删除',
'pages.searchTable.batchApproval': '批量审批',
'pages.header.search.placeholder':'服务查询',
+ 'pages.service.title':'查询服务',
+ 'pages.service.searchresult.table.title':'查询结果',
+ 'pages.service.searchresult.column.servicename':'服务名',
+ 'pages.service.searchresult.column.servicename.tip':'服务名称是唯一的 key',
+ 'pages.service.searchresult.column.groupname':'组名',
+ 'pages.service.searchresult.column.version':'版本',
+ 'pages.service.searchresult.column.appname':'应用名',
+ 'pages.common.button.detail':'详情',
};
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+import { Button, message, Input, Drawer } from 'antd';
+import React, { useState, useRef } from 'react';
+import { useIntl, FormattedMessage } from 'umi';
+import { PageContainer, FooterToolbar } from '@ant-design/pro-layout';
+import type { ProColumns, ActionType } from '@ant-design/pro-table';
+import ProTable from '@ant-design/pro-table';
+import type { TableListItem } from './data.d';
+import { queryService} from './service';
+import {NodeExpandOutlined} from '@ant-design/icons'
-import React, { useState } from 'react';
+const Service: React.FC = () => {
-const Service:React.FC = () => {
- return (<div>service</div>);
-}
+ const actionRef = useRef<ActionType>();
+ /** 国际化配置 */
+ const intl = useIntl();
+
+ /** 查询列表 */
+ const fetchServiceList = async (params:any)=>{
+
+ let param = {};
+ param.page = params.current - 1;
+ param.size = params.pageSize;
+ param.pattern = 'service';
+ if(params.service){
+ param.filter = params.service;
+ }else{
+ param.filter = '*';
+ }
+
+ let serviceResponseData = await queryService(param);
+ return {data:serviceResponseData.content,success:true,total:serviceResponseData.totalElements};
+ }
+
+
+ const columns: ProColumns<TableListItem>[] = [
+ {
+ title: (
+ <FormattedMessage
+ id="pages.service.searchresult.column.servicename"
+ defaultMessage="服务名"
+ />
+ ),
+ dataIndex: 'service',
+ tip:'服务名称是唯一的 key'
+ },
+ {
+ title: <FormattedMessage id="pages.service.searchresult.column.groupname" defaultMessage="组名" />,
+ dataIndex: 'group',
+ valueType: 'textarea',
+ search:false
+ },
+ {
+ title: <FormattedMessage id="pages.service.searchresult.column.version" defaultMessage="版本" />,
+ dataIndex: 'version',
+ hideInForm: true,
+ search:false
+ },
+ {
+ title: <FormattedMessage id="pages.service.searchresult.column.appname" defaultMessage="应用名" />,
+ dataIndex: 'appName',
+ hideInForm: true,
+ search:false
+ },
+ {
+ title: <FormattedMessage id="pages.searchTable.titleOption" defaultMessage="操作" />,
+ dataIndex: 'option',
+ valueType: 'option',
+ render: (_, record) => [
+ <Button type="primary" icon={<NodeExpandOutlined />}>
+ <FormattedMessage id="pages.common.button.detail" defaultMessage="详情" />
+ </Button>
+ ],
+ },
+ ];
+
+ return (
+ <PageContainer title={intl.formatMessage({
+ id: 'pages.service.title',
+ defaultMessage: '查询服务',
+ })}>
+ <ProTable<TableListItem>
+ headerTitle={intl.formatMessage({
+ id: 'pages.service.searchresult.table.title',
+ defaultMessage: '查询服务',
+ })}
+ actionRef={actionRef}
+ rowKey={(item,index)=>{
+ return item.service?(item.service+index):index+'';
+ }}
+ search={{
+ labelWidth: 120,
+ collapseRender:false
+ }}
+ request={(params, sorter, filter) =>fetchServiceList({ ...params, sorter,filter})}
+ columns={columns}
+ />
+ </PageContainer>
+ );
+};
export default Service;