完成数据库接引功能

This commit is contained in:
RenCheng 2025-02-21 23:44:28 +08:00
parent 2025bd90c2
commit efdc2edd99
10 changed files with 1222 additions and 26 deletions

26
src/api/dblink.js Normal file
View File

@ -0,0 +1,26 @@
import { getAction, deleteAction, putAction, postAction, httpAction,uploadAction } from '@/api/manage'
const datasyncqueryPage = (params)=>getAction("/datasync/queryPage",params);
const datasyncqueryById = (params)=>getAction("/datasync/queryById",params);
const datasynccreateSyncRecord = (params)=>postAction("/datasync/createSyncRecord",params);
const datasynccreateSchema = (params)=>postAction("/datasync/createSchema",params);
const datasyncgetDatabases = (params)=>getAction("/datasync/getDatabases",params);
const datasyncgetTableInfo = (params)=>getAction("/datasync/getTableInfo",params);
const datasynctestConn = (params)=>getAction("/datasync/testConn",params);
const datasyncsyncOriginalData = (params)=>getAction("/datasync/syncOriginalData",params);
const datasyncgetSyncLog = (params)=>getAction("/datasync/getSyncLog",params);
export {
datasyncqueryPage,
datasyncqueryById,
datasynccreateSyncRecord,
datasynccreateSchema,
datasyncgetDatabases,
datasyncgetTableInfo,
datasynctestConn,
datasyncsyncOriginalData,
datasyncgetSyncLog
}

View File

@ -0,0 +1,208 @@
<template>
<a-card :bordered="false">
<!-- 查询区域 -->
<div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24">
<a-col :md="6" :sm="8">
<a-form-item label="模式名称">
<a-input placeholder="请输入搜索关键词" v-model="queryParam.schemaName"></a-input>
</a-form-item>
</a-col>
<a-col :md="6" :sm="8">
<a-form-item label="表名">
<a-input placeholder="请输入搜索关键词" v-model="queryParam.tableName"></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" @click="loadData" icon="search">查询</a-button>
<a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px;left: 10px">重置</a-button>
<a-button type="primary" @click="handleAdd" icon="upload" style="margin-left: 8px;left: 10px">上传</a-button>
</a-col>
</span>
</a-row>
</a-form>
</div>
<!-- table区域-begin -->
<div style="height:900px;overflow-y:auto;">
<a-table
ref="table"
size="middle"
bordered
rowKey="id"
:columns="columns"
:dataSource="dataSource"
:pagination="ipagination"
:loading="loading"
:rowSelection="{selectedRowKeys: selectedRowKeys,onChange: onSelectChange}"
@change="handleTableChange">
<!-- :locale="myLocale"-->
<!-- 字符串超长截取省略号显示-->
<span slot="name" slot-scope="text">
<j-ellipsis :value="text" :length="20" />
</span>
<span slot="describe" slot-scope="text">
<j-ellipsis :value="text" :length="20" />
</span>
<span slot="action" slot-scope="text, record">
<a @click="processFile(record)" v-has="'cont:btn'">解析</a>
<a-divider type="vertical" v-has="'cont:btn'" />
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
<a>删除</a>
</a-popconfirm>
</span>
</a-table>
</div>
<!-- table区域-end -->
<!-- 表单区域 -->
<uploadModal ref="modalForm"></uploadModal>
</a-card>
</template>
<script>
import uploadModal from './modules/uploadModal'
import { getFileLinkInfo,processFile,fileDataLinkDelete } from '@/api/fileDataLink'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import JEllipsis from "@/components/jeecg/JEllipsis";
import {deleteAction, postAction} from '@/api/manage'
export default {
name: "waterDocuments",
mixins:[JeecgListMixin],
components: {
uploadModal,
JEllipsis,
VNodes: {
functional: true,
render: (h, ctx) => ctx.props.vnodes,
},
},
data () {
return {
description: '文件接引',
dataSources: [],
queryParam: {
pageNum :1,
pageSize:20,
schemaName:'',
tableName:'',
dataLinkType:'3'
},
columns: [
{
title: '#',
dataIndex: '',
key:'id',
width:60,
align:"id",
customRender:function (t,r,index) {
return parseInt(index)+1;
}
},
{
title: '文件名称',
align:"fileName",
dataIndex: 'fileName',
},
{
title: '创建时间',
align:"createTime",
dataIndex: 'createTime'
},
{
title: '模式名称',
align:"schemaName",
dataIndex: 'schemaName'
},
{
title: '表名',
align:"tableName",
dataIndex: 'tableName',
},
{
title: '解析时间开始',
align:"analyzeStartTime",
dataIndex: 'analyzeStartTime',
},
{
title: '解析时间完成',
align:"analyzeEndTime",
dataIndex: 'analyzeEndTime',
},
{
title: '操作',
dataIndex: 'action',
align:"center",
width:180,
scopedSlots: { customRender: 'action' },
}
]
}
},
computed: {
},
created () {
this.loadData();
},
methods: {
//handleTableChange
handleTableChange(pagination, filters, sorter) {
//
//TODO
if (Object.keys(sorter).length > 0) {
this.isorter.column = sorter.field;
this.isorter.order = "ascend" == sorter.order ? "asc" : "desc"
}
this.ipagination = pagination;
this.loadData();
},
loadData() {
getFileLinkInfo(this.queryParam).then((res) => {
if (res.success) {
this.dataSource = res.result.records;
if(res.result.total)
{
this.ipagination.total = res.result.total;
}
} else {
this.$message.warning(res.message);
}
});
},
handleDelete: function (id) {
var that = this;
deleteAction("/fileDataLink/delete?id="+id,{}).then((res) => {
if (res.success) {
this.$message.success(res.message);
that.loadData();
} else {
this.$message.warning(res.message);
}
});
},
processFile: function (record) {
var that = this;
postAction("/fileDataLink/processFile?dataLinkId="+record.id,{}).then((res) => {
if (res.success) {
this.$message.success(res.message);
that.loadData();
} else {
this.$message.warning(res.message);
}
});
},
handleAdd() {
this.$refs.modalForm.add();
this.$refs.modalForm.title = "文件上传";
this.$refs.modalForm.dataLinkType=this.queryParam.dataLinkType;
},
}
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>

View File

@ -0,0 +1,208 @@
<template>
<a-card :bordered="false">
<!-- 查询区域 -->
<div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24">
<a-col :md="6" :sm="8">
<a-form-item label="模式名称">
<a-input placeholder="请输入搜索关键词" v-model="queryParam.schemaName"></a-input>
</a-form-item>
</a-col>
<a-col :md="6" :sm="8">
<a-form-item label="表名">
<a-input placeholder="请输入搜索关键词" v-model="queryParam.tableName"></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" @click="loadData" icon="search">查询</a-button>
<a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px;left: 10px">重置</a-button>
<a-button type="primary" @click="handleAdd" icon="upload" style="margin-left: 8px;left: 10px">上传</a-button>
</a-col>
</span>
</a-row>
</a-form>
</div>
<!-- table区域-begin -->
<div style="height:900px;overflow-y:auto;">
<a-table
ref="table"
size="middle"
bordered
rowKey="id"
:columns="columns"
:dataSource="dataSource"
:pagination="ipagination"
:loading="loading"
:rowSelection="{selectedRowKeys: selectedRowKeys,onChange: onSelectChange}"
@change="handleTableChange">
<!-- :locale="myLocale"-->
<!-- 字符串超长截取省略号显示-->
<span slot="name" slot-scope="text">
<j-ellipsis :value="text" :length="20" />
</span>
<span slot="describe" slot-scope="text">
<j-ellipsis :value="text" :length="20" />
</span>
<span slot="action" slot-scope="text, record">
<a @click="processFile(record)" v-has="'cont:btn'">解析</a>
<a-divider type="vertical" v-has="'cont:btn'" />
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
<a>删除</a>
</a-popconfirm>
</span>
</a-table>
</div>
<!-- table区域-end -->
<!-- 表单区域 -->
<uploadModal ref="modalForm"></uploadModal>
</a-card>
</template>
<script>
import uploadModal from './modules/uploadModal'
import { getFileLinkInfo,processFile,fileDataLinkDelete } from '@/api/fileDataLink'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import JEllipsis from "@/components/jeecg/JEllipsis";
import {deleteAction, postAction} from '@/api/manage'
export default {
name: "waterDocuments",
mixins:[JeecgListMixin],
components: {
uploadModal,
JEllipsis,
VNodes: {
functional: true,
render: (h, ctx) => ctx.props.vnodes,
},
},
data () {
return {
description: '文件接引',
dataSources: [],
queryParam: {
pageNum :1,
pageSize:20,
schemaName:'',
tableName:'',
dataLinkType:'2'
},
columns: [
{
title: '#',
dataIndex: '',
key:'id',
width:60,
align:"id",
customRender:function (t,r,index) {
return parseInt(index)+1;
}
},
{
title: '文件名称',
align:"fileName",
dataIndex: 'fileName',
},
{
title: '创建时间',
align:"createTime",
dataIndex: 'createTime'
},
{
title: '模式名称',
align:"schemaName",
dataIndex: 'schemaName'
},
{
title: '表名',
align:"tableName",
dataIndex: 'tableName',
},
{
title: '解析时间开始',
align:"analyzeStartTime",
dataIndex: 'analyzeStartTime',
},
{
title: '解析时间完成',
align:"analyzeEndTime",
dataIndex: 'analyzeEndTime',
},
{
title: '操作',
dataIndex: 'action',
align:"center",
width:180,
scopedSlots: { customRender: 'action' },
}
]
}
},
computed: {
},
created () {
this.loadData();
},
methods: {
//handleTableChange
handleTableChange(pagination, filters, sorter) {
//
//TODO
if (Object.keys(sorter).length > 0) {
this.isorter.column = sorter.field;
this.isorter.order = "ascend" == sorter.order ? "asc" : "desc"
}
this.ipagination = pagination;
this.loadData();
},
loadData() {
getFileLinkInfo(this.queryParam).then((res) => {
if (res.success) {
this.dataSource = res.result.records;
if(res.result.total)
{
this.ipagination.total = res.result.total;
}
} else {
this.$message.warning(res.message);
}
});
},
handleDelete: function (id) {
var that = this;
deleteAction("/fileDataLink/delete?id="+id,{}).then((res) => {
if (res.success) {
this.$message.success(res.message);
that.loadData();
} else {
this.$message.warning(res.message);
}
});
},
processFile: function (record) {
var that = this;
postAction("/fileDataLink/processFile?dataLinkId="+record.id,{}).then((res) => {
if (res.success) {
this.$message.success(res.message);
that.loadData();
} else {
this.$message.warning(res.message);
}
});
},
handleAdd() {
this.$refs.modalForm.add();
this.$refs.modalForm.title = "文件上传";
this.$refs.modalForm.dataLinkType=this.queryParam.dataLinkType;
},
}
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>

View File

@ -0,0 +1,257 @@
<template>
<a-card :bordered="false">
<!-- 查询区域 -->
<div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24">
<a-col :md="6" :sm="8">
<a-form-item label="数据库名称">
<a-input placeholder="请输入搜索关键词" v-model="databaseName"></a-input>
</a-form-item>
</a-col>
<a-col :md="6" :sm="8">
<a-form-item label="数据类型">
<a-select placeholder="选择数据类型" option-filter-prop="children" size="large" v-model="dataTypeId">
<a-select-option v-for="d in dataTypedataSources" :key="d.id">
{{ d.cnName }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :md="6" :sm="8">
<a-form-item label="同步状态">
<a-select placeholder="选择同步状态" option-filter-prop="children" size="large" v-model="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>
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
<a-col :md="6" :sm="24" >
<a-button type="primary" style="left: 10px" @click="loadData" icon="search">查询</a-button>
<a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px;left: 10px">重置</a-button>
</a-col>
</span>
</a-row>
</a-form>
</div>
<!-- table区域-begin -->
<div style="height:900px;overflow-y:auto;">
<a-button type="primary" @click="handleAdd" icon="upload" style="margin-left: 8px;left: 10px;margin-bottom: 10px;">添加</a-button>
<a-table
ref="table"
size="middle"
bordered
rowKey="id"
:columns="columns"
:dataSource="dataSource"
:pagination="ipagination"
:loading="loading"
:rowSelection="{selectedRowKeys: selectedRowKeys,onChange: onSelectChange}"
@change="handleTableChange">
<!-- :locale="myLocale"-->
<!-- 字符串超长截取省略号显示-->
<template slot="syncState" slot-scope="text">
<span style="color: #fff;;" v-if="text === 1" >未开始</span>
<span style="color:darkorange;" v-if="text === 2">进行中</span>
<span style="color:#87d068;" v-if="text === 3">已完成</span>
</template>
<span slot="action" slot-scope="text, record">
<a @click="handleEdit(record)" v-has="'cont:btn'">编辑</a>
<a-divider type="vertical" v-has="'cont:btn'" />
<a @click="getSyncLog(record)" v-has="'cont:btn'">详情</a>
</span>
</a-table>
</div>
<!-- table区域-end -->
<!-- 表单区域 -->
<creatdblink ref="modalForm"></creatdblink>
<syncLog ref="syncLog"></syncLog>
</a-card>
</template>
<script>
import creatdblink from './modules/creatdblink'
import syncLog from './modules/syncLog'
import { datasyncqueryPage } from '@/api/dblink'
import {
dataTypePageList,
dataTypeDeleteById } from '@/api/dataType'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import JEllipsis from "@/components/jeecg/JEllipsis";
export default {
name: "dblink",
mixins:[JeecgListMixin],
components: {
creatdblink,
syncLog,
JEllipsis,
VNodes: {
functional: true,
render: (h, ctx) => ctx.props.vnodes,
},
},
data () {
return {
description: '数据库接引',
dataSources: [],
queryParam: {
pageNum :1,
pageSize:20,
},
databaseName:'',
dataTypeId:'',
syncState:'',
dataTypequeryParam: {
pageNum :1,
pageSize:20
},
dataTypedataSources: [],
columns: [
{
title: '#',
dataIndex: '',
key:'id',
width:60,
align:"id",
customRender:function (t,r,index) {
return parseInt(index)+1;
}
},
{
title: '本地名称',
align:"dataBaseaName",
dataIndex: 'dataBaseaName',
},
{
title: '数据类型',
align:"dataTypeName",
dataIndex: 'dataTypeName'
},
{
title: '同步状态',
align:"center",
dataIndex: 'syncState',
scopedSlots: { customRender: 'syncState' },
},
{
title: '开始时间',
align:"startTime",
dataIndex: 'startTime',
},
{
title: '完成时间',
align:"endTime",
dataIndex: 'endTime',
},
{
title: '完成时长',
align:"execDuration",
dataIndex: 'execDuration',
},
{
title: '操作',
dataIndex: 'action',
align:"center",
width:180,
scopedSlots: { customRender: 'action' },
}
]
}
},
computed: {
},
created () {
this.loadData();
this.getdataType();
},
methods: {
//handleTableChange
handleTableChange(pagination, filters, sorter) {
//
//TODO
if (Object.keys(sorter).length > 0) {
this.isorter.column = sorter.field;
this.isorter.order = "ascend" == sorter.order ? "asc" : "desc"
}
this.ipagination = pagination;
this.loadData();
},
searchReset(){
this.queryParam= {
pageNum :1,
pageSize:20,
}
this.databaseName =''
this.dataTypeId=''
this.syncState=''
},
loadData() {
let queryParam = {};
queryParam.pageNum = this.queryParam.pageNum;
queryParam.pageSize = this.queryParam.pageSize;
if(this.databaseName != ''){
queryParam.databaseName = this.databaseName;
}
if(this.dataTypeId != ''){
queryParam.dataTypeId = this.dataTypeId;
}
if(this.syncState != ''){
queryParam.syncState = this.syncState;
}
datasyncqueryPage(queryParam).then((res) => {
if (res.success) {
this.dataSource = res.result.rows;
if(res.result.total)
{
this.ipagination.total = res.result.total;
}
} else {
this.$message.warning(res.message);
}
});
},
getdataType(){
dataTypePageList(this.dataTypequeryParam).then((res) => {
if (res.success) {
this.dataTypedataSources = res.result.rows||res.result;
} else {
this.$message.warning(res.message);
}
});
},
handleAdd() {
this.$refs.modalForm.add();
this.$refs.modalForm.title = "添加同步";
this.$refs.modalForm.models =1;
},
handleEdit(value) {
this.$refs.modalForm.models =1;
this.$refs.modalForm.edit(value);
this.$refs.modalForm.title = "编辑同步";
},
getSyncLog(value){
this.$refs.syncLog.edit(value);
this.$refs.syncLog.title = "同步日志";
}
}
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>

View File

@ -231,7 +231,7 @@ export default {
})
},
buildFileFormData (fileName, fileSize, md5Value, shareTotal, shareIndex, file, fileShare) {
buildFileFormData (fileName, fileSize, md5Value, shareTotal, shareIndex, file, fileShare,currShareM5) {
const formData = new FormData()
formData.append('fileShare', fileShare)
formData.append('fileName', fileName)
@ -239,7 +239,7 @@ export default {
formData.append('fileSize', fileSize)
formData.append('md5Value', md5Value)
formData.append('shareTotal', shareTotal)
formData.append('shareIndex', shareIndex)
formData.append('shareIndex', shareIndex+1)
formData.append('currShareM5', currShareM5)
formData.append('file', file)
formData.append("dataLinkType",this.dataLinkType);
@ -262,7 +262,7 @@ export default {
currentRow.uploadStatus = 2
currentRow.result = res
} else { //
const formData = this.buildFileFormData(file.name, file.size, fileMD5Value, 0, 0, file, false)
const formData = this.buildFileFormData(file.name, file.size, fileMD5Value, 0, 0, file, false,fileMD5Value)
const url = '/fileDataLink/uploadFile'
try {
const res = await postAction(url, formData)
@ -350,12 +350,13 @@ export default {
* 对切片文件进行上传
* @param {File} file
*/
uploadSliceFile (file, currentRow, slicingSize, sumSlicingCount, currIndex, success, error) {
async uploadSliceFile (file, currentRow, slicingSize, sumSlicingCount, currIndex, success, error) {
if (currIndex < sumSlicingCount && !this.isStop) {
//
const currentInfo = this.getSlicingInfo(file, currIndex, slicingSize)
const result = new File([currentInfo], currIndex, { type: file.type, lastModified: Date.now() })
const formData = this.buildFileFormData(file.name, file.size, this.fileMD5[file.uid], sumSlicingCount, currIndex, result, true)
let fileMD5Value = await this.getMd5(result, result.size)
const formData = this.buildFileFormData(file.name, file.size, this.fileMD5[file.uid], sumSlicingCount, currIndex, result, true,fileMD5Value)
//
const url = '/fileDataLink/uploadFile'

View File

@ -0,0 +1,356 @@
<template>
<a-modal
:title="title"
:width="800"
:visible="visible"
:confirmLoading="confirmLoading"
@ok="handleOk"
@cancel="handleCancel"
okText="保存数据"
cancelText="关闭">
<a-spin :spinning="confirmLoading">
<a-form :form="form" v-if = "models == 1">
<a-form-item :labelCol="labelCol"
:wrapperCol="wrapperCol" label="数据库IP" >
<a-input v-decorator="['ip']" :disabled="testConnBool"></a-input>
</a-form-item>
<a-form-item :labelCol="labelCol"
:wrapperCol="wrapperCol" label="端口号" >
<a-input v-decorator="['port']" :disabled="testConnBool"></a-input>
</a-form-item>
<a-form-item :labelCol="labelCol"
:wrapperCol="wrapperCol" label="用户名" >
<a-input v-decorator="['username']" :disabled="testConnBool"></a-input>
</a-form-item>
<a-form-item :labelCol="labelCol"
:wrapperCol="wrapperCol" label="密码" >
<a-input v-decorator="['password']" :disabled="testConnBool"></a-input>
</a-form-item>
<a-form-item >
<a-button type="primary" @click="testConn" style="width:100%;">测试数据库连接</a-button>
</a-form-item>
<a-form-item label="选择源数据库" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-select show-search :disabled="selectDataBase"placeholder="选择源数据库" option-filter-prop="children" :filter-option="filterOption" size="large" v-decorator="['database', {}]">
<a-select-option v-for="d in databaseSource" :key="d">
{{ d }}
</a-select-option>
</a-select>
</a-form-item>
<a-form-item label="数据类型">
<a-select placeholder="选择数据类型" :disabled="selectDataBase" option-filter-prop="children" size="large" v-decorator="['dataType', {}]">
<a-select-option v-for="d in dataTypedataSources" :key="d.id">
{{ d.cnName }}
</a-select-option>
</a-select>
</a-form-item>
<a-form-item label="选择型号">
<a-select placeholder="选择型号" :disabled="selectDataBase" @change="QueryByModelId" option-filter-prop="children" size="large" v-decorator="['shipModel', {}]">
<a-select-option v-for="d in shipModelSources" :key="d.id">
{{ d.name }}
</a-select-option>
</a-select>
</a-form-item>
<a-form-item label="选择舷号">
<a-select placeholder="选择舷号" :disabled="selectDataBase" option-filter-prop="children" size="large" v-decorator="['shipNum', {}]">
<a-select-option v-for="d in shipNumSources" :key="d.id">
{{ d.name }}
</a-select-option>
</a-select>
</a-form-item>
<a-form-item >
<a-button :disabled="selectDataBase" type="primary" style="width:100%;" @click="createSchema">验证目标模式</a-button>
</a-form-item>
<a-form-item >
<a-button :disabled="createSchemaboll" type="primary" style="width:100%;" @click="getTableInfo">开始同步</a-button>
</a-form-item>
</a-form>
<a-table v-if="models == 2"
ref="table"
size="middle"
bordered
rowKey="id"
:columns="columns"
:dataSource="dataSource"
:loading="loading">
<!-- :locale="myLocale"-->
<!-- 字符串超长截取省略号显示-->
</a-table>
<a-button v-if="models == 2" type="primary" style="width:100%;" @click="syncOriginalData">同步</a-button>
</a-spin>
</a-modal>
</template>
<script>
import moment from "moment"
import { shipNumPageList,shipModelPageList,shipNumQueryByModelId } from '@/api/ship'
import JCron from "@/components/jeecg/JCron";
import JSelectMultiple from '@/components/jeecg/JSelectMultiple'
import pick from 'lodash.pick'
import {
dataTypePageList,
dataTypeDeleteById } from '@/api/dataType'
import { datasyncqueryPage,
datasyncqueryById,
datasyncsyncOriginalData,
datasynccreateSyncRecord,
datasynccreateSchema,
datasyncgetDatabases,
datasyncgetTableInfo,
datasynctestConn } from '@/api/dblink'
export default {
name: "uploadModal",
components: {
JCron,
JSelectMultiple
},
data () {
return {
title:"操作",
buttonStyle: 'solid',
visible: false,
confirmLoading: false,
form: this.$form.createForm(this),
strategys:[],
dataLinkType:'',
models:1,
labelCol: {
xs: { span: 24 },
sm: { span: 5 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 },
},
columns: [
{
title: '#',
dataIndex: '',
key:'id',
width:60,
align:"id",
customRender:function (t,r,index) {
return parseInt(index)+1;
}
},
{
title: '表名',
align:"tableName",
dataIndex: 'tableName',
},
{
title: '数据条数',
align:"rowCount",
dataIndex: 'rowCount'
},
],
queryParam: {
pageNum :1,
pageSize:20
},
dataTypedataSources: [],
shipModelSources:[],
shipNumSources:[],
dataSource:[],
selectDataBase:true,
createSchemaboll:true,
testConnBool:false,
databaseSource:[],
datamodel:{
ip:"",
port:"",
username:"",
password:"",
database:"",
dataType:"",
shipModel:"",
shipNum:""
},
recordId:""
}
},
created () {
},
methods: {
add () {
this.edit({});
},
edit (record) {
this.visible =true;
let that = this;
that.form.resetFields();
console.log(record);
this.model = Object.assign({},record);
this.getselect();
datasyncqueryById({id:this.model.id}).then((res) => {
if (res.success) {
let model = {};
model.ip = res.result.sourceIp;
model.port = res.result.sourcePort;
model.username = res.result.username;
model.password = res.result.password;
model.database = res.result.sourceDatabase;
model.dataType = res.result.dataTypeId;
model.shipModel = res.result.shipModelId;
model.shipNum = res.result.shipNumId;
this.form.setFieldsValue(pick(model,'ip','port','username','password','database','dataType','shipModel','shipNum'));
} else {
this.$message.warning(res.message);
}
});
},
syncOriginalData(){
datasyncsyncOriginalData({recordId:this.recordId}).then((res) => {
if (res.success) {
this.$message.success(res.message);
} else {
this.$message.warning(res.message);
}
});
},
getTableInfo(){
this.form.validateFields((err, values) => {
console.log('values',values)
this.datamodel = values;
var that = this;
if (!err) {
that.confirmLoading = true;
datasyncgetTableInfo({ip:values.ip,port:values.port,username:values.username,password:values.password,database:values.database}).then((res) => {
if (res.result) {
this.confirmLoading = false;
this.dataSource = res.result;
this.models = 2;
} else {
this.$message.warning(res.message);
}
});
datasynccreateSyncRecord({sourceIp:values.ip,
sourcePort:values.port,
username:values.username,
password:values.password,
sourceDatabase:values.database,
dataTypeId:values.dataType,
shipModelId:values.shipModel,
shipNumId:values.shipNum}).then((res) => {
if (res.success) {
this.recordId = res.result
this.$message.success(res.message);
} else {
this.$message.warning(res.message);
}
});
}
})
},
QueryByModelId(val){
shipNumQueryByModelId({modelId:val}).then((res) => {
if (res.success) {
this.shipNumSources = res.result.rows||res.result;
} else {
this.$message.warning(res.message);
}
});
},
createSchema(){
this.form.validateFields((err, values) => {
console.log('values',values)
this.datamodel = values;
var that = this;
if (!err) {
that.confirmLoading = true;
datasynccreateSchema({shipModelId:this.datamodel.shipModel,shipNumId:this.datamodel.shipNum,dataTypeId:this.datamodel.dataType}).then((res) => {
if (res.success) {
this.createSchemaboll =false;
this.confirmLoading = false;
} else {
this.$message.warning(res.message);
}
});
}
})
},
filterOption(input, option) {
return (
option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
);
},
testConn(){
this.form.validateFields((err, values) => {
console.log('values',values)
this.datamodel = values;
var that = this;
if (!err) {
that.confirmLoading = true;
datasynctestConn({ip:values.ip,port:values.port,username:values.username,password:values.password}).then((res) => {
if (res.result) {
this.confirmLoading = false;
this.getdatabaseList();
} else {
this.$message.warning(res.message);
}
});
}
})
},
getdatabaseList(){
datasyncgetDatabases({ip:this.datamodel.ip,port:this.datamodel.port,username:this.datamodel.username,password:this.datamodel.password}).then((res) => {
if (res.success) {
this.selectDataBase = false;
this.databaseSource = res.result;
this.getselect();
} else {
this.$message.warning(res.message);
}
});
},
getselect(){
dataTypePageList(this.queryParam).then((res) => {
if (res.success) {
this.dataTypedataSources = res.result.rows||res.result;
} else {
this.$message.warning(res.message);
}
});
shipModelPageList(this.queryParam).then((res) => {
if (res.success) {
this.shipModelSources = res.result.rows||res.result;
} else {
this.$message.warning(res.message);
}
});
shipNumPageList(this.queryParam).then((res) => {
if (res.success) {
this.shipNumSources = res.result.rows||res.result;
} else {
this.$message.warning(res.message);
}
});
},
onOk(value) {
},
close () {
this.$emit('close');
this.visible = false;
},
handleOk () {
this.close();
},
handleCancel () {
this.close()
},
}
}
</script>
<style scoped>
.disabled{
pointer-events: none;
}
</style>

View File

@ -0,0 +1,131 @@
<template>
<a-modal
:title="title"
:width="800"
:visible="visible"
:confirmLoading="confirmLoading"
@ok="handleOk"
@cancel="handleCancel"
okText="确认"
cancelText="关闭">
<a-table
ref="table"
size="middle"
bordered
rowKey="id"
:columns="columns"
:dataSource="dataSource">
<!-- :locale="myLocale"-->
<!-- 字符串超长截取省略号显示-->
</a-table>
</a-modal>
</template>
<script>
import moment from "moment"
import JCron from "@/components/jeecg/JCron";
import JSelectMultiple from '@/components/jeecg/JSelectMultiple'
import { datasyncgetSyncLog } from '@/api/dblink'
export default {
name: "syncLog",
components: {
JCron,
JSelectMultiple
},
data () {
return {
title:"操作",
buttonStyle: 'solid',
labelCol: {
xs: { span: 24 },
sm: { span: 5 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 },
},
visible: false,
confirmLoading: false,
strategys:[],
dataLinkType:'',
model:{},
queryParam: {
lastId :0,
num:50,
syncTaskId :""
},
columns: [
{
title: '#',
dataIndex: '',
key:'id',
width:60,
align:"id",
customRender:function (t,r,index) {
return parseInt(index)+1;
}
},
{
title: '同步记录',
align:"content",
dataIndex: 'content',
width:300,
},
{
title: '执行时间',
align:"createTime",
dataIndex: 'createTime',
width:60,
},
],
dataSource:{},
}
},
created () {
},
methods: {
add () {
this.visible =true;
},
edit (record) {
this.syncTaskId = record.id;
this.queryParam.syncTaskId = record.id;
this.visible =true;
this.getSyncLog();
},
onOk(value) {
},
getSyncLog(){
datasyncgetSyncLog(this.queryParam).then((res) => {
if (res.success) {
this.dataSource = res.result
} else {
this.$message.warning(res.message);
}
});
},
close () {
this.$emit('close');
this.visible = false;
},
handleOk () {
this.close();
},
handleCancel () {
this.close()
},
}
}
</script>
<style scoped>
.disabled{
pointer-events: none;
}
</style>

View File

@ -104,9 +104,9 @@
}
},
{
title: '任务名称',
align:"name",
dataIndex: 'name',
title: '文件名称',
align:"fileName",
dataIndex: 'fileName',
},
{
title: '创建时间',
@ -114,19 +114,24 @@
dataIndex: 'createTime'
},
{
title: '开始时间',
align:"startTime",
dataIndex: 'startTime'
title: '模式名称',
align:"schemaName",
dataIndex: 'schemaName'
},
{
title: '结束时间',
align:"endTime",
dataIndex: 'endTime',
title: '表名',
align:"tableName",
dataIndex: 'tableName',
},
{
title: '下发时间',
align:"issuingTime",
dataIndex: 'issuingTime',
title: '解析时间开始',
align:"analyzeStartTime",
dataIndex: 'analyzeStartTime',
},
{
title: '解析时间完成',
align:"analyzeEndTime",
dataIndex: 'analyzeEndTime',
},
{
title: '操作',
@ -158,7 +163,7 @@
loadData() {
getFileLinkInfo(this.queryParam).then((res) => {
if (res.success) {
this.dataSource = res.result;
this.dataSource = res.result.records;
if(res.result.total)
{
this.ipagination.total = res.result.total;
@ -181,7 +186,7 @@
},
processFile: function (record) {
var that = this;
postAction("/fileDataLink/processFile?id="+record.id,{}).then((res) => {
postAction("/fileDataLink/processFile?dataLinkId="+record.id,{}).then((res) => {
if (res.success) {
this.$message.success(res.message);
that.loadData();

View File

@ -182,7 +182,7 @@ export default {
if (currentRow) {
// 0
currentRow.percentage = 0
const _20M = 20 * 1024 * 1024
const _20M = 1 * 1024 * 1024
if (file.size > _20M) { // 20M
this.uploadByPieces({ //
file, //
@ -240,7 +240,7 @@ export default {
formData.append('fileSize', fileSize)
formData.append('md5Value', md5Value)
formData.append('shareTotal', shareTotal)
formData.append('shareIndex', shareIndex)
formData.append('shareIndex', shareIndex+1)
formData.append('currShareM5', currShareM5)
formData.append('file', file)
@ -258,7 +258,8 @@ export default {
}
try {
const res = await verifyFileExist({ fileMD5Value })
if (res.exist) { //
console.log(res.result.exist);
if (res.result.exist) { //
currentRow.percentage = 100
currentRow.uploadStatus = 2
currentRow.result = res
@ -328,7 +329,7 @@ export default {
//
verifyFileExist({ fileMD5Value: this.fileMD5[file.uid] })
.then((res) => {
const { exist, shareTotal, shareIndex } = res
const { exist, shareTotal, shareIndex } = res.result
if (exist) {
if (shareIndex === (shareTotal - 1)) { //
currentRow.percentage = 100
@ -351,12 +352,13 @@ export default {
* 对切片文件进行上传
* @param {File} file
*/
uploadSliceFile (file, currentRow, slicingSize, sumSlicingCount, currIndex, success, error) {
async uploadSliceFile (file, currentRow, slicingSize, sumSlicingCount, currIndex, success, error) {
if (currIndex < sumSlicingCount && !this.isStop) {
//
const currentInfo = this.getSlicingInfo(file, currIndex, slicingSize)
const result = new File([currentInfo], currIndex, { type: file.type, lastModified: Date.now() })
const formData = this.buildFileFormData(file.name, file.size, this.fileMD5[file.uid], sumSlicingCount, currIndex, result, true,this.fileMD5[file.uid])
let fileMD5Value = await this.getMd5(result, result.size)
const formData = this.buildFileFormData(file.name, file.size, this.fileMD5[file.uid], sumSlicingCount, currIndex, result, true,fileMD5Value)
//
const url = '/file/uoloadFile'

View File

@ -5,7 +5,9 @@
:visible="visible"
:confirmLoading="confirmLoading"
@ok="handleOk"
okText="保存">
@cancel="handleCancel"
okText="保存"
cancelText="关闭">
<a-spin :spinning="confirmLoading">
<SliceUpload