IDCDatasync-vue/src/views/data/dataCataloguing.vue

305 lines
9.8 KiB
Vue
Raw Normal View History

2025-03-07 15:44:35 +08:00
<template>
<a-row>
<a-col :md="11" style="padding:0 20px;">
<div class="linese"></div>
2025-03-07 15:44:35 +08:00
<!-- 查询区域 -->
2025-03-09 13:33:24 +08:00
<a-form layout="inline" @keyup.enter.native="gettagTables" style="margin-top: 10px; margin-left: 4px;">
2025-03-07 15:44:35 +08:00
<a-row :gutter="24">
<a-col :md="10" :sm="2">
<a-form-item label="标签类型">
2025-03-09 13:33:24 +08:00
<a-select placeholder="选择标签类型" option-filter-prop="children" size="large" v-model="queryRefsParam.tagId" style="width: 180px;">
<a-select-option v-for="d in datatagSources" :key="d.id">
{{ d.tagName }}
</a-select-option>
</a-select>
2025-03-07 15:44:35 +08:00
</a-form-item>
</a-col>
2025-03-09 13:33:24 +08:00
<a-col :md="10" :sm="1">
<a-form-item label="关键词">
<a-input placeholder="请输入搜索关键词" v-model="queryRefsParam.tableName"></a-input>
</a-form-item>
</a-col>
2025-03-07 15:44:35 +08:00
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
<a-col :md="4" :sm="3" >
2025-03-09 13:33:24 +08:00
<a-button type="primary" style="left: 10px" @click="gettagTables" icon="search">查询</a-button>
2025-03-07 15:44:35 +08:00
</a-col>
</span>
</a-row>
</a-form>
<!-- table区域-begin -->
<div style="height:calc(100vh - 324px);">
2025-03-07 15:44:35 +08:00
<a-table
2025-03-09 13:33:24 +08:00
ref="tagtable"
2025-03-07 15:44:35 +08:00
size="middle"
2025-03-09 13:33:24 +08:00
:loading="tagloading"
:row-selection="tagrowSelection"
2025-03-07 15:44:35 +08:00
bordered
rowKey="id"
2025-03-09 13:33:24 +08:00
:pagination="false"
2025-03-09 13:54:08 +08:00
:scroll="{ y: tableScrollY }"
2025-03-09 13:33:24 +08:00
:columns="tagcolumns"
:dataSource="dataRefsSources">
2025-03-07 15:44:35 +08:00
</a-table>
</div>
<div class="linese"></div>
2025-03-07 15:44:35 +08:00
</a-col>
<a-col :md="2">
2025-03-07 15:44:35 +08:00
<div style="padding-top: 100%; padding-left: 15%;">
2025-03-09 13:33:24 +08:00
<a-button type="primary" @click="addtag"> <a-icon type="left" />添加标签 </a-button>
2025-03-07 15:44:35 +08:00
<div style="height: 50px;"></div>
2025-03-09 13:33:24 +08:00
<a-button type="primary" @click="detag">移除标签<a-icon type="right" /> </a-button>
2025-03-07 15:44:35 +08:00
</div>
</a-col>
<a-col :md="11" style="padding:0 20px;">
<div class="linese"></div>
2025-03-09 13:33:24 +08:00
<a-form layout="inline" @keyup.enter.native="getalltable" style="margin-top: 10px; margin-left: 4px;">
2025-03-07 15:44:35 +08:00
<a-row :gutter="24">
<a-col :md="20" :sm="1">
<a-form-item label="关键词">
2025-03-09 13:33:24 +08:00
<a-input placeholder="请输入搜索关键词" v-model="queryParam.tableName"></a-input>
2025-03-07 15:44:35 +08:00
</a-form-item>
</a-col>
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
<a-col :md="4" :sm="3" >
2025-03-09 13:33:24 +08:00
<a-button type="primary" style="left: 10px" @click="getalltable" icon="search">查询</a-button>
2025-03-07 15:44:35 +08:00
</a-col>
</span>
</a-row>
</a-form>
<!-- table区域-begin -->
2025-03-09 13:54:08 +08:00
<div ref="tableWrapper" style="height:calc(100vh - 324px);">
2025-03-07 15:44:35 +08:00
<a-table
ref="table"
size="middle"
2025-03-09 13:33:24 +08:00
:row-selection="rowSelection"
2025-03-07 15:44:35 +08:00
bordered
2025-03-09 13:33:24 +08:00
:loading="loading"
:rowKey="getRowKey"
:pagination="false"
2025-03-09 13:54:08 +08:00
:scroll="{ y:tableScrollY }"
2025-03-07 15:44:35 +08:00
:columns="columns"
2025-03-09 13:33:24 +08:00
:dataSource="dataSource">
2025-03-07 15:44:35 +08:00
</a-table>
</div>
<div class="linese"></div>
2025-03-07 15:44:35 +08:00
</a-col>
</a-row>
</template>
<script>
import store from '@/store/'
import {getAction} from '@/api/manage'
2025-03-09 13:33:24 +08:00
import { idcTableTagRef,
getTableTagRefs,
getAllTable,
idcTableTagRefdelete } from '@/api/idcTableTagRef'
import { idcTableTaglist } from '@/api/tag'
2025-03-07 15:44:35 +08:00
export default {
name: "dataManage",
components: {
},
data () {
return {
description: '标准库',
contentList:[],
percent:0,
websock:{},
2025-03-09 13:33:24 +08:00
queryRefsParam: {
tableName :"",
tagId:"",
pageNum :1,
pageSize:9999999,
},
2025-03-07 15:44:35 +08:00
queryParam: {
2025-03-09 13:33:24 +08:00
tableName :"",
tagId:"",
pageNum :1,
pageSize:9999999,
2025-03-07 15:44:35 +08:00
},
2025-03-09 13:33:24 +08:00
datatagSources: [],
dataRefsSources:[],
2025-03-07 15:44:35 +08:00
dataSource:[
2025-03-09 13:33:24 +08:00
],
tagloading:false,
loading:false,
columns: [
2025-03-07 15:44:35 +08:00
{
2025-03-09 13:33:24 +08:00
title: '表名',
align:"left",
dataIndex: 'tableName',
},
{
2025-03-09 13:33:24 +08:00
title: '报文名',
align:"left",
dataIndex: 'tableMessName'
2025-03-07 15:44:35 +08:00
},
],
2025-03-09 13:33:24 +08:00
tagcolumns: [
2025-03-07 15:44:35 +08:00
{
title: '#',
dataIndex: '',
key:'id',
width:60,
2025-03-09 13:33:24 +08:00
align:"center",
2025-03-07 15:44:35 +08:00
customRender:function (t,r,index) {
return parseInt(index)+1;
}
},
{
title: '表名',
2025-03-09 13:33:24 +08:00
align:"left",
2025-03-07 15:44:35 +08:00
dataIndex: 'tableName',
},
{
title: '报文名',
2025-03-09 13:33:24 +08:00
align:"left",
dataIndex: 'tableMessName'
2025-03-07 15:44:35 +08:00
},
],
2025-03-09 13:33:24 +08:00
tagqueryParam: {
pageNum :1,
pageSize:20,
tagName:""
},
selectedRowKeys: [],
tagselectedRowKeys: [],
selectedRowData: [],
tagselectedRowData: [],
2025-03-09 13:54:08 +08:00
tableScrollY:0,
2025-03-07 15:44:35 +08:00
}
},
mounted() {
2025-03-09 13:33:24 +08:00
this.getdatatagSources()
2025-03-07 15:44:35 +08:00
},
computed: {
2025-03-09 13:33:24 +08:00
getRowKey(record) {
return `${record.schemaName}_${record.tableName}`
},
rowSelection() {
return {
selectedRowKeys: this.selectedRowKeys,
onChange: this.handleSelectChange,
preserveSelectedRowKeys: true, // 保持选中项key
type: 'checkbox', // 多选模式
columnWidth: 60, // 选择列宽度
getCheckboxProps: record => ({
// 可以在这里设置禁用条件
// disabled: record.disabled
})
}
},
tagrowSelection() {
return {
selectedRowKeys: this.tagselectedRowKeys,
onChange: this.taghandleSelectChange,
preserveSelectedRowKeys: true, // 保持选中项key
type: 'checkbox', // 多选模式
columnWidth: 60, // 选择列宽度
getCheckboxProps: record => ({
// 可以在这里设置禁用条件
// disabled: record.disabled
})
}
}
2025-03-07 15:44:35 +08:00
},
destroyed: function () {
},
created () {
},
methods: {
2025-03-09 13:54:08 +08:00
updateScrollY() {
const container = this.$refs.tableWrapper;
const paginationHeight = 64; // 分页栏高度
const tableHeaderHeight = 55; // 表头高度
this.tableScrollY = container.clientHeight - paginationHeight - tableHeaderHeight;
},
2025-03-09 13:33:24 +08:00
handleSelectChange(selectedRowKeys,row) {
this.selectedRowKeys = selectedRowKeys
this.selectedRowData = row
},
taghandleSelectChange(selectedRowKeys,row) {
this.tagselectedRowKeys = selectedRowKeys
this.tagselectedRowData = row
},
gattable(){
this.getalltable();
this.gettagTables();
},
getdatatagSources(){
idcTableTaglist(this.tagqueryParam).then((res) => {
if (res.success) {
this.datatagSources = res.result.records;
this.queryRefsParam.tagId = res.result.records[0].id;
this.gattable();
} else {
this.$message.warning(res.message);
}
});
},
2025-03-07 15:44:35 +08:00
dataAdd(){
getAction("/dataSpecial/special").then((res) => {
if (res.success) {
this.$message.success(res.message);
}
});
},
2025-03-08 12:53:29 +08:00
2025-03-09 13:33:24 +08:00
addtag(){
var that = this;
this.selectedRowData.forEach(item => {
idcTableTagRef({
"tagId": that.queryParam.tagId,
"tableName": item.tableName,
"schemaName": item.schemaName
}).then((res) => {
if (res.success) {
that.gattable();
} else {
that.$message.warning(res.message);
}
});
})
2025-03-07 15:44:35 +08:00
},
2025-03-09 13:33:24 +08:00
detag(){
var that = this;
this.tagselectedRowKeys.forEach(item => {
idcTableTagRefdelete({id: item}).then((res) => {
if (res.success) {
that.gattable();
} else {
that.$message.warning(res.message);
}
});
});
},
getalltable(){
this.queryParam.tagId = this.queryRefsParam.tagId
this.loading = true;
getAllTable(this.queryParam).then((res) => {
if (res.success) {
this.dataSource = res.result;
} else {
this.$message.warning(res.message);
}
this.loading = false;
});
},
gettagTables(){
this.tagloading = true;
getTableTagRefs(this.queryRefsParam).then((res) => {
if (res.success) {
this.dataRefsSources = res.result.records;
} else {
this.$message.warning(res.message);
}
this.tagloading = false;
});
2025-03-07 15:44:35 +08:00
},
}
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>