260 lines
8.0 KiB
Vue
260 lines
8.0 KiB
Vue
<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:black;" v-if="text === 0" >未同步</span>
|
|
<span style="color:darkorange;" v-if="text === 1">进行中</span>
|
|
<span style="color:#87d068;" v-if="text === 2">已完成</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" @ok="loadData"></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;
|
|
}
|
|
setTimeout(()=>{
|
|
this.loadData();
|
|
},5000)
|
|
} 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> |