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

195 lines
5.8 KiB
Vue
Raw Normal View History

2025-03-01 12:33:56 +08:00
<template>
2025-03-07 15:44:35 +08:00
<a-row :gutter="30">
<a-col :md="12" :sm="1" >
<!-- 查询区域 -->
<div class="table-page-search-wrapper">
2025-03-08 17:12:10 +08:00
<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 -->
<div style="height:900px;overflow-y:auto;">
<a-table
ref="table"
size="middle"
bordered
2025-03-08 12:43:26 +08:00
:pagination="false"
:scroll="{ y: 800 }"
2025-03-07 15:44:35 +08:00
rowKey="id"
:columns="columns"
:dataSource="dataSource">
<!-- :locale="myLocale"-->
2025-03-01 12:33:56 +08:00
2025-03-07 15:44:35 +08:00
<!-- 字符串超长截取省略号显示-->
</a-table>
</div>
</a-col>
<a-col :md="12" :sm="2" >
<a-card :bordered="false">
<!-- 查询区域 -->
<div class="table-page-search-wrapper">
<a-form layout="inline">
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
2025-03-08 18:49:35 +08:00
<a-button @click="dataAdd" type="primary" icon="plus">数据清洗整编</a-button>
2025-03-07 15:44:35 +08:00
</span>
</a-form>
<a-progress :percent="percent" status="active" />
</div>
<!-- table区域-begin -->
<div style="height:900px;overflow-y:auto;">
<a-list bordered :data-source="contentList">
<a-list-item slot="renderItem" slot-scope="item, index">
{{ item }}
</a-list-item>
</a-list>
</div>
</a-card>
</a-col>
</a-row>
2025-03-01 12:33:56 +08:00
</template>
<script>
import store from '@/store/'
import {getAction} from '@/api/manage'
2025-03-07 15:44:35 +08:00
import {
dataTypePageList,
dataTypeDeleteById } from '@/api/dataType'
2025-03-01 12:33:56 +08:00
export default {
2025-03-07 15:44:35 +08:00
name: "dataCleansing",
2025-03-01 12:33:56 +08:00
components: {
},
data () {
return {
2025-03-07 15:44:35 +08:00
description: '原始库',
2025-03-01 12:33:56 +08:00
contentList:[],
percent:0,
websock:{},
2025-03-08 17:12:10 +08:00
datatypequeryParam: {
schemaName:"",
sourceType:1
},
2025-03-07 15:44:35 +08:00
queryParam: {
2025-03-08 13:51:02 +08:00
pageNum :1,
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-08 18:49:35 +08:00
dataIndex: 'tableMessName'
2025-03-07 15:44:35 +08:00
},
{
title: '开始时间',
align:"center",
2025-03-08 18:49:35 +08:00
dataIndex: 'startTime'
2025-03-07 15:44:35 +08:00
},
{
title: '最后更新时间',
align:"center",
2025-03-08 18:49:35 +08:00
dataIndex: 'endTime'
2025-03-07 15:44:35 +08:00
},
{
title: '标签类型',
align:"center",
2025-03-08 18:49:35 +08:00
dataIndex: 'tagNames'
2025-03-07 15:44:35 +08:00
},
],
2025-03-01 12:33:56 +08:00
}
},
mounted() {
//初始化websocket
2025-03-08 12:43:26 +08:00
this.initWebSocket()
this.getselect()
2025-03-01 12:33:56 +08:00
},
computed: {
},
destroyed: function () { // 离开页面生命周期函数
var userId = store.getters.userInfo.id;
this.websock.send("close_"+userId);
this.websocketclose();
2025-03-01 12:33:56 +08:00
},
created () {
},
methods: {
initWebSocket: function () {
// WebSocket与普通的请求所用协议有所不同ws等同于httpwss等同于https
var userId = store.getters.userInfo.id;
2025-03-01 16:52:51 +08:00
var url = window._CONFIG['domianURL'].replace("https://","ws://").replace("http://","ws://")+"/websocket/"+userId+"/data_cleaning";
2025-03-01 12:33:56 +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-03-01 12:33:56 +08:00
},
websocketonerror: function (e) {
2025-03-01 17:03:57 +08:00
this.contentList.unshift("消息服务连接失败"+JSON.stringify(e));
2025-03-01 12:33:56 +08:00
},
websocketonmessage: function (e) {
var data = eval("(" + e.data + ")");
if(data.content.length >0){
2025-03-01 17:03:57 +08:00
this.contentList.unshift(data.content);
2025-03-01 12:33:56 +08:00
}
2025-03-08 14:20:26 +08:00
if(data.currProgress != null){
this.percent = data.currProgress;
}
2025-03-01 12:33:56 +08:00
},
websocketclose: function (e) {
console.log("connection closed (" + e + ")");
},
dataAdd(){
2025-03-08 14:20:26 +08:00
getAction("/dataCleaning/cleaning?taskId=3806ce79-dc28-48a3-9250-c7729e6b3ad4").then((res) => {
2025-03-01 12:33:56 +08:00
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-08 18:49:35 +08:00
this.datatypequeryParam.schemaName = res.result.rows[0].cnName
2025-03-08 17:12:10 +08:00
this.getTables();
2025-03-07 15:44:35 +08:00
} else {
this.$message.warning(res.message);
}
});
},
getTables(){
2025-03-08 18:49:35 +08:00
getAction("/dataManager/getDataManagerInfo",this.datatypequeryParam).then((res) => {
2025-03-08 17:12:10 +08:00
if (res.result) {
this.dataSource = res.result;
} else {
this.$message.warning(res.message);
}
});
2025-03-07 15:44:35 +08:00
},
2025-03-01 12:33:56 +08:00
}
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>