2025-04-19 21:58:36 +08:00
|
|
|
<template>
|
|
|
|
|
<a-card :bordered="false">
|
|
|
|
|
<!-- 查询区域 -->
|
|
|
|
|
<div class="table-page-search-wrapper">
|
|
|
|
|
<a-form layout="inline">
|
|
|
|
|
<a-row :gutter="30">
|
|
|
|
|
<a-col :md="20">
|
|
|
|
|
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
|
|
|
|
|
</span>
|
|
|
|
|
</a-col>
|
|
|
|
|
</a-row>
|
|
|
|
|
<a-row :gutter="24">
|
|
|
|
|
<a-col :md="6" :sm="8">
|
|
|
|
|
<a-form-item label="数据类型">
|
|
|
|
|
<a-select placeholder="选择同步状态" option-filter-prop="children" size="large" v-model="queryParam.schemaMass"
|
|
|
|
|
@change="handleTypeChange">
|
|
|
|
|
<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-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.massKey"></a-input>
|
|
|
|
|
</a-form-item>
|
|
|
|
|
</a-col>
|
2025-04-21 23:10:32 +08:00
|
|
|
<a-col :md="6" :sm="8">
|
|
|
|
|
<a-button type="primary" @click="handleAdd" icon="plus" style="margin-left: 8px;left: 10px">添加</a-button>
|
|
|
|
|
</a-col>
|
2025-04-19 21:58:36 +08:00
|
|
|
</a-row>
|
|
|
|
|
</a-form>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<a-row :gutter="30" style="padding: 0 10px;">
|
|
|
|
|
<a-col :md="6">
|
|
|
|
|
<div class="linese"></div>
|
|
|
|
|
<!-- 分类区域 -->
|
|
|
|
|
<div style="height:calc(100vh - 316px);background: #e6e9f1;padding:10px;">
|
|
|
|
|
<a-tree :tree-data="treeDate" @select="onSelect" />
|
|
|
|
|
</div>
|
|
|
|
|
<div class="linese"></div>
|
|
|
|
|
</a-col>
|
|
|
|
|
<a-col :md="18">
|
|
|
|
|
<div class="linese"></div>
|
|
|
|
|
<!-- 表格区域 -->
|
|
|
|
|
<div style="height:calc(100vh - 316px);background: #e6e9f1;overflow:hidden;padding: 15px;">
|
|
|
|
|
<a-table size="middle" bordered :columns="columns" :data-source="dataSource" :loading="loading"
|
2025-04-21 23:10:32 +08:00
|
|
|
:pagination="false" :scroll="{ y: 'calc(100vh - 380px)' }" rowKey="id">
|
|
|
|
|
<span slot="action" slot-scope="text, record">
|
|
|
|
|
<a @click="handleEdit(record)">编辑</a>
|
|
|
|
|
<a-divider type="vertical" />
|
|
|
|
|
<a @click="Delete(record, $event)">删除</a>
|
|
|
|
|
</span>
|
|
|
|
|
</a-table>
|
2025-04-19 21:58:36 +08:00
|
|
|
</div>
|
|
|
|
|
<div class="linese"></div>
|
|
|
|
|
</a-col>
|
|
|
|
|
</a-row>
|
|
|
|
|
</a-card>
|
|
|
|
|
</template>
|
|
|
|
|
<script>
|
2025-04-20 16:38:14 +08:00
|
|
|
import { metaDataTypeTree, tableIndexes } from '@/api/metaData'
|
2025-04-21 23:10:32 +08:00
|
|
|
import { getAction, deleteAction, putAction, postAction } from '@/api/manage'
|
2025-04-19 21:58:36 +08:00
|
|
|
export default {
|
|
|
|
|
name: "metadata",
|
|
|
|
|
components: {
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
loading: false,
|
|
|
|
|
// 查询条件
|
|
|
|
|
queryParam: {
|
|
|
|
|
sourceType: 1,
|
|
|
|
|
schemaMass: null,
|
|
|
|
|
massKey: null
|
|
|
|
|
},
|
|
|
|
|
tableParams: {
|
|
|
|
|
schemaMass: null,
|
|
|
|
|
tableName: null,
|
|
|
|
|
},
|
|
|
|
|
treeDate: [],
|
|
|
|
|
dataSource: [],
|
|
|
|
|
columns: [
|
|
|
|
|
{
|
|
|
|
|
title: '序号',
|
2025-04-20 16:38:14 +08:00
|
|
|
width: 70,
|
|
|
|
|
customRender: (text, record, index) => `${index + 1}`,
|
2025-04-19 21:58:36 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '索引名称',
|
|
|
|
|
align: "center",
|
2025-04-20 16:38:14 +08:00
|
|
|
dataIndex: 'indexName',
|
2025-04-19 21:58:36 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '字段',
|
|
|
|
|
align: "center",
|
2025-04-20 16:38:14 +08:00
|
|
|
dataIndex: 'columnName',
|
2025-04-19 21:58:36 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '索引类型',
|
|
|
|
|
align: "center",
|
2025-04-20 16:38:14 +08:00
|
|
|
dataIndex: 'indexType',
|
2025-04-19 21:58:36 +08:00
|
|
|
},
|
|
|
|
|
{
|
2025-04-20 16:38:14 +08:00
|
|
|
title: '是否唯一',
|
2025-04-19 21:58:36 +08:00
|
|
|
align: "center",
|
2025-04-20 16:38:14 +08:00
|
|
|
dataIndex: 'uniqueness',
|
2025-04-19 21:58:36 +08:00
|
|
|
},
|
|
|
|
|
{
|
2025-04-20 16:38:14 +08:00
|
|
|
title: '列在索引中的位置',
|
2025-04-19 21:58:36 +08:00
|
|
|
align: "center",
|
2025-04-20 16:38:14 +08:00
|
|
|
dataIndex: 'columnPosition',
|
2025-04-21 23:10:32 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '操作',
|
|
|
|
|
dataIndex: 'action',
|
|
|
|
|
align: "center",
|
|
|
|
|
width: 260,
|
|
|
|
|
scopedSlots: { customRender: 'action' },
|
2025-04-19 21:58:36 +08:00
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
watch: {
|
|
|
|
|
'queryParam.massKey'(value) {
|
|
|
|
|
this.queryParam.massKey = value
|
|
|
|
|
this.getMetaDataTypeTree()
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
mounted() {
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
computed: {
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
created() {
|
|
|
|
|
this.getMetaDataTypeTree()
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
2025-04-21 23:10:32 +08:00
|
|
|
Delete(item) {
|
|
|
|
|
var that = this
|
|
|
|
|
that.$confirm({
|
|
|
|
|
title: '确认删除',
|
|
|
|
|
content: '是否删除选中索引?',
|
|
|
|
|
onOk: function () {
|
|
|
|
|
postAction("/tableIndex/dropIndex?schemaMass="+this.tableParams.schemaMass+"&tableName="+this.tableParams.tableName+"&indexName="+item.indexName+"&columns="+item.columnName+"&indexTypeCode="+item.indexType,{}).then(res => {
|
|
|
|
|
if (res.success) {
|
|
|
|
|
that.$message.success(res.message);
|
|
|
|
|
this.getTableIndexList();
|
|
|
|
|
} else {
|
|
|
|
|
that.$message.warning(res.message);
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
},
|
2025-04-19 21:58:36 +08:00
|
|
|
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
|
2025-04-20 16:38:14 +08:00
|
|
|
this.getTableIndexList()
|
2025-04-19 21:58:36 +08:00
|
|
|
}
|
|
|
|
|
},
|
2025-04-20 16:38:14 +08:00
|
|
|
getTableIndexList() {
|
|
|
|
|
tableIndexes(this.tableParams).then(res => {
|
2025-04-19 21:58:36 +08:00
|
|
|
if (res.code == 200) {
|
2025-04-20 16:38:14 +08:00
|
|
|
this.dataSource = res.result
|
2025-04-19 21:58:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|