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

278 lines
8.2 KiB
Vue
Raw Normal View History

2025-02-28 16:06:28 +08:00
<template>
2025-03-09 15:53:07 +08:00
<a-row :gutter="30" style="padding: 0 10px;">
<a-col :md="14" >
<div class="linese"></div>
2025-03-07 15:44:35 +08:00
<!-- 查询区域 -->
2025-03-09 15:53:07 +08:00
<div class="table-page-search-wrapper" style="background: rgb(18, 44, 65);">
<a-select placeholder="选择数据类型" option-filter-prop="children" v-model="datatypequeryParam.schemaName" @change="getTables" style="width: 40%;">
<a-select-option v-for="d in dataTypedataSources" :key="d.enName">
2025-03-07 15:44:35 +08:00
{{ d.cnName }}
</a-select-option>
</a-select>
</div>
<!-- table区域-begin -->
2025-03-09 15:53:07 +08:00
<div ref="tableContainer" style="height:calc(100vh - 347px);background: rgb(18, 44, 65);padding:10px;">
2025-03-07 15:44:35 +08:00
<a-table
ref="table"
size="middle"
bordered
2025-03-09 15:53:07 +08:00
:pagination="false"
:scroll="{ y: tableScrollY }"
2025-03-07 15:44:35 +08:00
rowKey="id"
:columns="columns"
:dataSource="dataSource">
<!-- :locale="myLocale"-->
2025-02-28 16:06:28 +08:00
2025-03-07 15:44:35 +08:00
<!-- 字符串超长截取省略号显示-->
</a-table>
</div>
2025-03-09 15:53:07 +08:00
<div class="linese"></div>
2025-03-07 15:44:35 +08:00
</a-col>
2025-03-09 15:53:07 +08:00
<a-col :md="10">
<div class="linese"></div>
<a-card :bordered="false" style="background: rgb(18, 44, 65) !important;">
<!-- 查询区域 -->
<div class="table-page-search-wrapper">
<a-form layout="inline">
<a-row :gutter="24">
<a-col :md="12">
<a-form-item label="日志类型">
<a-select placeholder="选择日志类型" option-filter-prop="children" size="large" v-model="queryParam.syncState">
<a-select-option key="">
全部
</a-select-option>
<a-select-option key="0">
未同步
</a-select-option>
<a-select-option key="1">
进行中
</a-select-option>
<a-select-option key="2">
已结束
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :md="7">
</a-col>
<a-col :md="5">
<a-button @click="dataAdd" type="primary">发布到专题库</a-button>
</a-col>
2025-03-07 15:44:35 +08:00
2025-03-09 15:53:07 +08:00
</a-row>
</a-form>
</div>
<!-- table区域-begin -->
<div class="datacleanResult">
<div class="progressbg">
<div class="title">发布进度</div>
<a-progress :percent="percent" status="active" class="progress" />
</div>
<a-list :data-source="contentList" style="padding:10px 20px;">
<a-list-item slot="renderItem" slot-scope="item">
{{ item }}
</a-list-item>
</a-list>
</div>
2025-03-07 15:44:35 +08:00
</a-card>
2025-03-09 15:53:07 +08:00
<div class="linese"></div>
2025-03-07 15:44:35 +08:00
</a-col>
</a-row>
2025-02-28 16:06:28 +08:00
</template>
<script>
2025-02-28 16:46:55 +08:00
import store from '@/store/'
2025-02-28 16:06:28 +08:00
import {getAction} from '@/api/manage'
2025-03-07 15:44:35 +08:00
import {
dataTypePageList,
dataTypeDeleteById } from '@/api/dataType'
2025-02-28 16:06:28 +08:00
export default {
name: "dataManage",
components: {
},
data () {
return {
2025-03-07 15:44:35 +08:00
description: '标准库',
2025-02-28 16:39:13 +08:00
contentList:[],
percent:0,
websock:{},
2025-03-09 15:53:07 +08:00
datatypequeryParam: {
schemaName:"",
sourceType:2
},
2025-03-07 15:44:35 +08:00
queryParam: {
2025-03-08 13:51:02 +08:00
pageNum :1,
2025-03-09 15:53:07 +08:00
pageSize:9999999,
2025-03-07 15:44:35 +08:00
},
dataTypedataSources: [],
dataSource:[
],
columns: [
{
title: '#',
dataIndex: '',
key:'id',
width:60,
align:"id",
customRender:function (t,r,index) {
return parseInt(index)+1;
}
},
{
title: '表名',
align:"center",
dataIndex: 'tableName',
},
{
title: '报文名',
align:"center",
2025-03-09 15:53:07 +08:00
dataIndex: 'tableMessName'
2025-03-07 15:44:35 +08:00
},
{
title: '开始时间',
align:"center",
2025-03-09 15:53:07 +08:00
dataIndex: 'startTime'
2025-03-07 15:44:35 +08:00
},
{
title: '最后更新时间',
align:"center",
2025-03-09 15:53:07 +08:00
dataIndex: 'endTime'
2025-03-07 15:44:35 +08:00
},
{
title: '标签类型',
align:"center",
2025-03-09 15:53:07 +08:00
dataIndex: 'tagNames'
2025-03-07 15:44:35 +08:00
},
],
2025-03-09 15:53:07 +08:00
tableScrollY:0
2025-02-28 16:06:28 +08:00
}
},
mounted() {
//初始化websocket
this.initWebSocket()
2025-03-07 15:44:35 +08:00
this.getselect()
2025-03-09 15:53:07 +08:00
this.calculateScrollY();
2025-02-28 16:06:28 +08:00
},
computed: {
},
destroyed: function () { // 离开页面生命周期函数
var userId = store.getters.userInfo.id;
this.websock.send("close_"+userId);
this.websocketclose();
2025-02-28 16:06:28 +08:00
},
created () {
2025-02-28 16:39:13 +08:00
2025-02-28 16:06:28 +08:00
},
methods: {
2025-03-09 15:53:07 +08:00
calculateScrollY() {
// 获取父容器高度(需减去表格内其他元素的高度,如分页栏)
const container = this.$refs.tableContainer;
const paginationHeight = 64; // 根据实际分页栏高度调整
this.tableScrollY = container.clientHeight - paginationHeight;
},
2025-02-28 16:06:28 +08:00
initWebSocket: function () {
// WebSocket与普通的请求所用协议有所不同ws等同于httpwss等同于https
2025-02-28 16:46:55 +08:00
var userId = store.getters.userInfo.id;
var url = window._CONFIG['domianURL'].replace("https://","ws://").replace("http://","ws://")+"/websocket/"+userId+"/data_distribute";
2025-02-28 16:06:28 +08:00
this.websock = new WebSocket(url);
this.websock.onopen = this.websocketonopen;
this.websock.onerror = this.websocketonerror;
this.websock.onmessage = this.websocketonmessage;
this.websock.onclose = this.websocketclose;
},
websocketonopen: function () {
2025-03-01 17:03:57 +08:00
this.contentList.unshift("消息服务连接成功");
2025-02-28 16:06:28 +08:00
},
websocketonerror: function (e) {
2025-03-01 17:03:57 +08:00
this.contentList.unshift("消息服务连接失败"+JSON.stringify(e));
2025-02-28 16:06:28 +08:00
},
websocketonmessage: function (e) {
var data = eval("(" + e.data + ")");
2025-02-28 16:39:13 +08:00
console.log(data);
2025-02-28 16:06:28 +08:00
//处理订阅信息
2025-03-01 11:53:38 +08:00
if(data.content.length >0){
2025-03-01 17:03:57 +08:00
this.contentList.unshift(data.content);
2025-03-01 11:53:38 +08:00
}
if(data.currProgress != null){
2025-03-01 12:05:05 +08:00
this.percent = data.currProgress;
2025-03-01 11:53:38 +08:00
}
2025-02-28 16:06:28 +08:00
},
websocketclose: function (e) {
2025-02-28 16:46:55 +08:00
console.log("connection closed (" + e + ")");
2025-02-28 16:06:28 +08:00
},
dataAdd(){
getAction("/dataSpecial/special").then((res) => {
if (res.success) {
this.$message.success(res.message);
}
});
},
2025-03-07 15:44:35 +08:00
getselect(){
dataTypePageList(this.queryParam).then((res) => {
if (res.success) {
this.dataTypedataSources = res.result.rows||res.result;
2025-03-09 15:53:07 +08:00
this.datatypequeryParam.schemaName = res.result.rows[0].cnName
this.getTables();
2025-03-07 15:44:35 +08:00
} else {
this.$message.warning(res.message);
}
});
},
getTables(){
2025-03-09 15:53:07 +08:00
getAction("/dataManager/getDataManagerInfo",this.datatypequeryParam).then((res) => {
if (res.result) {
this.dataSource = res.result;
} else {
this.$message.warning(res.message);
}
});
2025-03-07 15:44:35 +08:00
},
2025-02-28 16:06:28 +08:00
}
}
</script>
<style scoped>
@import '~@assets/less/common.less';
2025-03-09 15:53:07 +08:00
/deep/ .ant-table-bordered .ant-table-header > table {
border: none !important;
}
.datacleanResult{
height:calc(100vh - 374px);
overflow-y:auto;
margin: 10px;
background: rgb(11,34,52);
}
.datacleanResult .progressbg{
margin: 10px;
height: 60px;
padding:20px 10px;
background: rgb(17,42,64);
}
.datacleanResult .title{
width: 14%;
font-size: 16px;
float: left;
text-align: right;
line-height: 20px;
color:#fff;
}
.datacleanResult .progress{
width: 86%;
float: left;
}
.datacleanResult .ant-progress-bg,
.datacleanResult .ant-progress-inner{
height: 16px !important;
}
.datacleanResult .ant-progress-bg{
background: linear-gradient(180deg, rgb(43,97,48),rgb(75,160,75),rgb(43,97,48));
}
.datacleanResult .ant-progress-text{
color:#fff;
}
.datacleanResult .ant-list-items{
border-bottom:1px dashed rgb(35,72,100);
color:#fff;
}
2025-02-28 16:06:28 +08:00
</style>