对接元数据

This commit is contained in:
wangchengming 2025-04-19 15:04:59 +08:00
parent db3baa97ee
commit 23fe88212f
2 changed files with 100 additions and 41 deletions

9
src/api/metaData.js Normal file
View File

@ -0,0 +1,9 @@
import { getAction, deleteAction, putAction, postAction } from '@/api/manage'
const metaDataTypeTree = (params)=>getAction("/dataManager/getAllTable",params);
const metaDatalist = (params)=>getAction("/dataManager/getTableColumns",params);
export {
metaDataTypeTree,
metaDatalist
}

View File

@ -13,33 +13,36 @@
<a-col :md="6" :sm="8">
<a-form-item label="数据类型">
<a-select placeholder="选择同步状态" option-filter-prop="children" size="large"
v-model="queryParam.syncState">
<a-select-option key="">
全部
v-model="queryParam.schemaMass" @change="handleTypeChange">
<a-select-option key="平台">
平台
</a-select-option>
<a-select-option key="0">
未同步
<a-select-option key="编队">
编队
</a-select-option>
<a-select-option key="1">
进行中
<a-select-option key="航空兵">
航空兵
</a-select-option>
<a-select-option key="2">
已结束
<a-select-option key="陆战队">
陆战队
</a-select-option>
<a-select-option key="作战">
作战
</a-select-option>
<a-select-option key="反潜">
反潜
</a-select-option>
<a-select-option key="舰炮">
舰炮
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :md="6" :sm="8">
<a-form-item label="关键词">
<a-input placeholder="请输入搜索关键词" v-model="queryParam.databaseName"></a-input>
<a-input placeholder="请输入搜索关键词" v-model="queryParam.massKey"></a-input>
</a-form-item>
</a-col>
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
<a-col :md="6" :sm="24">
<a-button type="primary" style="left: 10px" icon="search">查询</a-button>
</a-col>
</span>
</a-row>
</a-form>
</div>
@ -49,7 +52,7 @@
<div class="linese"></div>
<!-- 分类区域 -->
<div style="height:calc(100vh - 300px);background: #e6e9f1;padding:10px;">
<a-tree :tree-data="treeDate" @select="onSelect" />
</div>
<div class="linese"></div>
</a-col>
@ -57,8 +60,8 @@
<div class="linese"></div>
<!-- 表格区域 -->
<div style="height:calc(100vh - 300px);background: #e6e9f1;overflow:hidden;padding: 15px;">
<a-table ref="table" size="middle" style="height:calc(100vh - 344px);" bordered rowKey="id"
:columns="columns" :dataSource="dataSource" :loading="loading">
<a-table ref="table" size="middle" bordered rowKey="id" :columns="columns" :dataSource="dataSource"
:pagination="false" :loading="loading" :scroll="{y: 'calc(100vh - 380px)' }">
<!-- 字符串超长截取省略号显示-->
<!-- <span slot="name" slot-scope="text">
@ -75,6 +78,7 @@
</a-card>
</template>
<script>
import { metaDataTypeTree, metaDatalist } from '@/api/metaData'
export default {
name: "metadata",
components: {
@ -84,55 +88,57 @@ export default {
loading: false,
//
queryParam: {
databaseName: null,
syncState: null,
pageNum: 1,
pageSize: 9999999,
sourceType: 1,
schemaMass: null,
massKey: null
},
tableParams: {
schemaMass: null,
tableName: null
},
treeDate: [],
dataSource: [],
columns: [
{
title: '序号',
dataIndex: '',
key: 'id',
dataIndex: 'columnId',
width: 60,
align: "center",
customRender: function (t, r, index) {
return parseInt(index) + 1;
}
},
{
title: '字段名称',
width: 200,
align: "center",
dataIndex: 'name',
dataIndex: 'columnName',
},
{
title: '索引类型',
width: 130,
title: '数据类型',
align: "center",
dataIndex: 'name',
dataIndex: 'dataType',
},
{
title: '数据长度',
width: 100,
align: "center",
dataIndex: 'name',
dataIndex: 'dataLength',
},
{
title: '数据精度',
width: 100,
title: '是否为空',
align: "center",
dataIndex: 'name',
dataIndex: 'nullable',
},
{
title: '描述',
title: '默认值',
align: "center",
dataIndex: 'issuingTime',
dataIndex: 'dataDefault',
}
]
}
},
watch: {
'queryParam.massKey'(value) {
this.queryParam.massKey = value
this.getMetaDataTypeTree()
}
},
mounted() {
},
@ -140,10 +146,54 @@ export default {
},
created() {
this.getMetaDataTypeTree()
},
methods: {
getMetaDataTypeTree() {
metaDataTypeTree(this.queryParam).then(res => {
if (res.code == 200) {
this.treeDate = []
var keys = Object.keys(res.result)
keys.forEach((element, index) => {
const _children = res.result[element]
var childrenList = []
_children.forEach((childrenNode, chil) => {
childrenList.push({
key: 'children_' + chil,
type: 'childern',
title: childrenNode
})
});
this.treeDate.push({
key: 'type_' + index,
type: 'parentType',
title: element,
children: childrenList
})
});
}
})
},
handleTypeChange(value) {
this.queryParam.schemaMass = value
this.getMetaDataTypeTree()
},
onSelect(selectedKeys, info) {
if (info.node.dataRef.type && info.node.dataRef.type == 'childern') {
this.tableParams.schemaMass = info.node.$parent.dataRef.title
this.tableParams.tableName = info.node.dataRef.title
this.getMetaDatalist()
}
},
getMetaDatalist() {
metaDatalist(this.tableParams).then(res => {
if (res.code == 200) {
this.dataSource = []
this.dataSource = res.result
}
})
}
}
}
</script>