4 changed files with 122 additions and 2 deletions
@ -0,0 +1,39 @@ |
|||
'use strict'; |
|||
|
|||
function searchMeta(opts) { |
|||
return async function (ctx, next) { |
|||
let errMsg = { message: '搜索元数据失败' } |
|||
try { |
|||
const models = ctx.fs.dc.models; |
|||
const { keywords } = ctx.query; |
|||
const where = {}; |
|||
|
|||
if (keywords) { |
|||
where['$or'] = [{ name: { $iLike: `%${keywords}%` } } |
|||
] |
|||
} |
|||
const findObj = { |
|||
include: [ |
|||
{ |
|||
model: models.TagDatabase, |
|||
include: [{ |
|||
model: models.Tag, |
|||
}] |
|||
}], |
|||
where: where |
|||
} |
|||
|
|||
const rslt = await models.MetadataDatabase.findAndCountAll(findObj); |
|||
ctx.status = 200; |
|||
ctx.body = rslt; |
|||
} catch (error) { |
|||
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); |
|||
ctx.status = 400; |
|||
ctx.body = errMsg |
|||
} |
|||
} |
|||
} |
|||
|
|||
module.exports = { |
|||
searchMeta |
|||
} |
@ -0,0 +1,9 @@ |
|||
'use strict'; |
|||
|
|||
const search = require('../../controllers/metadataSearch/index'); |
|||
|
|||
module.exports = function (app, router, opts, AuthCode) { |
|||
//获取适配器列表
|
|||
app.fs.api.logAttr['GET/meta/data/search'] = { content: '获取适配器列表', visible: true }; |
|||
router.get('/meta/data/search', search.searchMeta(opts)); |
|||
}; |
@ -1,7 +1,50 @@ |
|||
import React, { useEffect, useState } from 'react' |
|||
import { Input } from 'antd' |
|||
import { InsertRowBelowOutlined, DatabaseOutlined, FileOutlined, PullRequestOutlined } from '@ant-design/icons'; |
|||
import './style.less'; |
|||
function Retrieval(props) { |
|||
const renderMetaData = (type) => { |
|||
switch (type) { |
|||
case '库': |
|||
return <div className='result-row'> |
|||
<div className='column1'> |
|||
<InsertRowBelowOutlined /> 代码:T29E_34AC 名称:政务信息变更 类型:库表/表(Table) 路径:/demoABI/govern_metadata/ 标签:XX |
|||
</div> |
|||
<div className='column2'>相关操作:<a>定位</a></div> |
|||
</div> |
|||
case '表': |
|||
return <div className='result-row'> |
|||
<div className='column1'> |
|||
<DatabaseOutlined /> 代码:init_metadata 名称:政务大数据平台 类型:库表/库(Schema) 路径:/demoABI 标签:XX |
|||
</div> |
|||
<div className='column2'>相关操作:<a>定位</a><a>下载</a></div> |
|||
</div> |
|||
case '文件': |
|||
return <div className='result-row'> |
|||
<div className='column1'> |
|||
<FileOutlined /> 名称:政务大数据平台 类型:文件(File) 路径:/demoABI 标签:XX |
|||
</div> |
|||
<div className='column2'>相关操作:<a>定位</a><a>下载</a></div> |
|||
</div> |
|||
case '接口': |
|||
return <div className='result-row'> |
|||
<div className='column1'> |
|||
<PullRequestOutlined /> 名称:政务大数据平台 类型:接口(Api) 路径:/demoABII 标签:XX |
|||
</div> |
|||
<div className='column2'>相关操作:<a>定位</a></div> |
|||
</div> |
|||
default: |
|||
break; |
|||
} |
|||
} |
|||
|
|||
function Retrieval (props) { |
|||
return <>数据资源检索</> |
|||
return <> |
|||
<Input.Search style={{ width: '30%', marginLeft: 10, marginBottom: 30 }} /> |
|||
{renderMetaData('库')} |
|||
{renderMetaData('表')} |
|||
{renderMetaData('文件')} |
|||
{renderMetaData('接口')} |
|||
</> |
|||
} |
|||
|
|||
export default Retrieval |
@ -0,0 +1,29 @@ |
|||
.result-row { |
|||
display: flex; |
|||
border-bottom: 1px solid #E8E8E8; |
|||
width: 90%; |
|||
padding: 10px; |
|||
margin-bottom: 15px; |
|||
font-size: 15px; |
|||
|
|||
.column1 { |
|||
display: flex; |
|||
|
|||
.anticon { |
|||
font-size: 26px; |
|||
margin-right: 20px; |
|||
} |
|||
|
|||
width: calc(100% - 180px); |
|||
} |
|||
|
|||
.column2 { |
|||
width: 180px; |
|||
display: flex; |
|||
justify-content: flex-start; |
|||
|
|||
a { |
|||
margin-right: 8px; |
|||
} |
|||
} |
|||
} |
Loading…
Reference in new issue