mirror of
https://gitee.com/dromara/dbswitch.git
synced 2025-10-15 14:20:25 +00:00
自动同步模式
This commit is contained in:
@@ -22,8 +22,9 @@
|
||||
style="margin:10px 5px;"
|
||||
width="95%">
|
||||
<el-button type="primary"
|
||||
size="mini"
|
||||
icon="el-icon-document-add"
|
||||
@click="dialogVisible=true">添加驱动</el-button>
|
||||
@click="dialogVisible=true">添加</el-button>
|
||||
</div>
|
||||
<el-table :header-cell-style="{background:'#eef1f6',color:'#606266'}"
|
||||
:data="versionDrivers"
|
||||
@@ -88,7 +89,7 @@ export default {
|
||||
}).then(res => {
|
||||
if (0 === res.data.code) {
|
||||
this.connectionTypes = res.data.data;
|
||||
this.handleChooseClick('MYSQL',0);
|
||||
this.handleChooseClick('MYSQL', 0);
|
||||
} else {
|
||||
if (res.data.message) {
|
||||
alert("初始化数据库类型信息失败:" + res.data.message);
|
||||
@@ -173,7 +174,7 @@ export default {
|
||||
}
|
||||
|
||||
.container .el-card {
|
||||
width: 50%;
|
||||
width: 30%;
|
||||
height: 100%;
|
||||
overflow: auto;
|
||||
}
|
||||
@@ -209,5 +210,4 @@ export default {
|
||||
padding: 10px;
|
||||
width: calc(100% - 250px);
|
||||
}
|
||||
|
||||
</style>
|
@@ -7,15 +7,16 @@
|
||||
<el-input placeholder="请输入连接名称关键字搜索"
|
||||
v-model="keyword"
|
||||
@change="searchByKeyword"
|
||||
clearable=true
|
||||
:clearable=true
|
||||
style="width:300px">
|
||||
</el-input>
|
||||
</div>
|
||||
</div>
|
||||
<div class="right-add-button-group">
|
||||
<el-button type="primary"
|
||||
size="mini"
|
||||
icon="el-icon-document-add"
|
||||
@click="createFormVisible=true">添加</el-button>
|
||||
@click="addConnection">添加</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -28,62 +29,52 @@
|
||||
min-width="5%"></el-table-column>
|
||||
<el-table-column prop="name"
|
||||
label="连接名称"
|
||||
show-overflow-tooltip
|
||||
min-width="20%"></el-table-column>
|
||||
<el-table-column prop="createTime"
|
||||
label="创建时间"
|
||||
min-width="20%"></el-table-column>
|
||||
min-width="18%"></el-table-column>
|
||||
<el-table-column prop="type"
|
||||
label="数据库类型"
|
||||
show-overflow-tooltip
|
||||
min-width="10%"></el-table-column>
|
||||
<el-table-column prop="version"
|
||||
label="驱动版本"
|
||||
min-width="15%"></el-table-column>
|
||||
show-overflow-tooltip
|
||||
min-width="12%"></el-table-column>
|
||||
<el-table-column prop="url"
|
||||
label="JDBC连接串"
|
||||
show-overflow-tooltip
|
||||
min-width="30%"></el-table-column>
|
||||
min-width="15%"></el-table-column>
|
||||
<el-table-column prop="username"
|
||||
label="账号"
|
||||
show-overflow-tooltip
|
||||
min-width="10%"></el-table-column>
|
||||
<el-table-column label="操作"
|
||||
min-width="30%">
|
||||
min-width="35%">
|
||||
<template slot-scope="scope">
|
||||
<el-tooltip content="测试"
|
||||
placement="top"
|
||||
effect="dark">
|
||||
<el-button-group>
|
||||
<el-button size="small"
|
||||
type="danger"
|
||||
icon="el-icon-document-checked"
|
||||
icon="el-icon-video-play"
|
||||
@click="handleTest(scope.$index, scope.row)"
|
||||
circle></el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="详情"
|
||||
placement="top"
|
||||
effect="dark">
|
||||
round>测试</el-button>
|
||||
<el-button size="small"
|
||||
type="primary"
|
||||
icon="el-icon-document"
|
||||
@click="handleMore(scope.$index, scope.row)"
|
||||
circle></el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="编辑"
|
||||
placement="top"
|
||||
effect="dark">
|
||||
round>详情</el-button>
|
||||
<el-button size="small"
|
||||
type="warning"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.$index, scope.row)"
|
||||
circle></el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="删除"
|
||||
placement="top"
|
||||
effect="dark">
|
||||
round>编辑</el-button>
|
||||
<el-button size="small"
|
||||
type="success"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.$index, scope.row)"
|
||||
circle></el-button>
|
||||
</el-tooltip>
|
||||
round>删除</el-button>
|
||||
</el-button-group>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -137,6 +128,7 @@
|
||||
style="width:85%">
|
||||
<el-input type="textarea"
|
||||
:rows="6"
|
||||
:spellcheck="false"
|
||||
v-model="queryForm.url"
|
||||
auto-complete="off"
|
||||
:readonly=true></el-input>
|
||||
@@ -210,12 +202,21 @@
|
||||
<el-form-item label="JDBC连接串"
|
||||
label-width="120px"
|
||||
:required=true
|
||||
prop=""
|
||||
prop="url"
|
||||
style="width:85%">
|
||||
<el-tooltip placement="top">
|
||||
<i class="el-icon-question">样例:</i>
|
||||
<div slot="content">
|
||||
{{createform.sample}}
|
||||
</div>
|
||||
</el-tooltip>
|
||||
<el-input type="textarea"
|
||||
:rows="6"
|
||||
:spellcheck="false"
|
||||
placeholder="请输入"
|
||||
v-model="createform.url"
|
||||
auto-complete="off"></el-input>
|
||||
auto-complete="off">
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="账号名称"
|
||||
label-width="120px"
|
||||
@@ -292,6 +293,7 @@
|
||||
style="width:85%">
|
||||
<el-input type="textarea"
|
||||
:rows="6"
|
||||
:spellcheck="false"
|
||||
v-model="updateform.url"
|
||||
auto-complete="off"></el-input>
|
||||
</el-form-item>
|
||||
@@ -350,6 +352,8 @@ export default {
|
||||
title: "",
|
||||
type: "",
|
||||
diver: "",
|
||||
sample: "",
|
||||
url: "",
|
||||
version: "",
|
||||
username: "",
|
||||
password: ""
|
||||
@@ -378,6 +382,13 @@ export default {
|
||||
trigger: "change"
|
||||
}
|
||||
],
|
||||
version: [
|
||||
{
|
||||
required: true,
|
||||
message: "驱动版本必须选择",
|
||||
trigger: "change"
|
||||
}
|
||||
],
|
||||
url: [
|
||||
{
|
||||
required: true,
|
||||
@@ -434,6 +445,7 @@ export default {
|
||||
);
|
||||
},
|
||||
searchByKeyword: function () {
|
||||
this.currentPage = 1;
|
||||
this.loadData();
|
||||
},
|
||||
loadDatabaseTypes: function () {
|
||||
@@ -494,6 +506,10 @@ export default {
|
||||
}
|
||||
});
|
||||
},
|
||||
addConnection: function () {
|
||||
this.createFormVisible = true;
|
||||
this.createform = {};
|
||||
},
|
||||
handleCreate: function () {
|
||||
let driverClass = "";
|
||||
if (this.databaseType.length > 0) {
|
||||
@@ -545,6 +561,13 @@ export default {
|
||||
).then(res => {
|
||||
if (0 === res.data.code) {
|
||||
this.connectionDriver = res.data.data;
|
||||
let varDatabaseType = this.databaseType.find(
|
||||
(item) => {
|
||||
return item.type === value;
|
||||
});
|
||||
if (varDatabaseType) {
|
||||
this.createform.sample = varDatabaseType.sample;
|
||||
}
|
||||
} else {
|
||||
this.$message.error("查询数据库可用的驱动版本失败," + res.data.message);
|
||||
this.connectionDriver = [];
|
||||
|
@@ -66,7 +66,7 @@
|
||||
</el-table-column>
|
||||
<el-table-column prop="fieldType"
|
||||
min-width="7%"
|
||||
label="枚举值">
|
||||
label="jdbcType">
|
||||
</el-table-column>
|
||||
<el-table-column prop="displaySize"
|
||||
min-width="7%"
|
||||
@@ -74,7 +74,7 @@
|
||||
</el-table-column>
|
||||
<el-table-column prop="precision"
|
||||
min-width="5%"
|
||||
label="精确">
|
||||
label="精度">
|
||||
</el-table-column>
|
||||
<el-table-column prop="scale"
|
||||
min-width="5%"
|
||||
@@ -90,7 +90,7 @@
|
||||
</el-table-column>
|
||||
<el-table-column prop="isNullable"
|
||||
min-width="5%"
|
||||
label="空">
|
||||
label="可空">
|
||||
</el-table-column>
|
||||
<el-table-column prop="remarks"
|
||||
min-width="20%"
|
||||
|
@@ -6,7 +6,7 @@
|
||||
<div class="left-search-input">
|
||||
<el-input placeholder="请输入任务名称关键字搜索"
|
||||
v-model="keyword"
|
||||
clearable=true
|
||||
:clearable=true
|
||||
@change="searchByKeyword"
|
||||
style="width:300px">
|
||||
</el-input>
|
||||
@@ -14,6 +14,7 @@
|
||||
</div>
|
||||
<div class="right-add-button-group">
|
||||
<el-button type="primary"
|
||||
size="mini"
|
||||
icon="el-icon-document-add"
|
||||
@click="handleCreate">添加</el-button>
|
||||
</div>
|
||||
@@ -45,42 +46,44 @@
|
||||
<el-table-column label="操作"
|
||||
min-width="30%">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="small"
|
||||
type="primary"
|
||||
icon="el-icon-timer"
|
||||
v-if="scope.row.isPublished===false"
|
||||
@click="handlePublish(scope.$index, scope.row)"
|
||||
circle>发布</el-button>
|
||||
<el-button size="small"
|
||||
type="info"
|
||||
icon="el-icon-delete-location"
|
||||
v-if="scope.row.isPublished===true"
|
||||
@click="handleRetireTask(scope.$index, scope.row)"
|
||||
circle>下线</el-button>
|
||||
<el-button size="small"
|
||||
type="danger"
|
||||
icon="el-icon-video-play"
|
||||
v-if="scope.row.isPublished===true"
|
||||
@click="handleRunTask(scope.$index, scope.row)"
|
||||
circle>执行</el-button>
|
||||
<el-button size="small"
|
||||
type="success"
|
||||
icon="el-icon-document"
|
||||
v-if="scope.row.isPublished===true"
|
||||
@click="handleDetail(scope.$index, scope.row)"
|
||||
circle>详情</el-button>
|
||||
<el-button size="small"
|
||||
type="warning"
|
||||
icon="el-icon-edit"
|
||||
v-if="scope.row.isPublished===false"
|
||||
@click="handleUpdate(scope.$index, scope.row)"
|
||||
circle>修改</el-button>
|
||||
<el-button size="small"
|
||||
type="danger"
|
||||
icon="el-icon-delete"
|
||||
v-if="scope.row.isPublished===false"
|
||||
@click="handleDelete(scope.$index, scope.row)"
|
||||
circle>删除</el-button>
|
||||
<el-button-group>
|
||||
<el-button size="small"
|
||||
type="primary"
|
||||
icon="el-icon-timer"
|
||||
v-if="scope.row.isPublished===false"
|
||||
@click="handlePublish(scope.$index, scope.row)"
|
||||
round>发布</el-button>
|
||||
<el-button size="small"
|
||||
type="info"
|
||||
icon="el-icon-delete-location"
|
||||
v-if="scope.row.isPublished===true"
|
||||
@click="handleRetireTask(scope.$index, scope.row)"
|
||||
round>下线</el-button>
|
||||
<el-button size="small"
|
||||
type="danger"
|
||||
icon="el-icon-video-play"
|
||||
v-if="scope.row.isPublished===true"
|
||||
@click="handleRunTask(scope.$index, scope.row)"
|
||||
round>执行</el-button>
|
||||
<el-button size="small"
|
||||
type="success"
|
||||
icon="el-icon-document"
|
||||
v-if="scope.row.isPublished===true"
|
||||
@click="handleDetail(scope.$index, scope.row)"
|
||||
round>详情</el-button>
|
||||
<el-button size="small"
|
||||
type="warning"
|
||||
icon="el-icon-edit"
|
||||
v-if="scope.row.isPublished===false"
|
||||
@click="handleUpdate(scope.$index, scope.row)"
|
||||
round>修改</el-button>
|
||||
<el-button size="small"
|
||||
type="danger"
|
||||
icon="el-icon-delete"
|
||||
v-if="scope.row.isPublished===false"
|
||||
@click="handleDelete(scope.$index, scope.row)"
|
||||
round>删除</el-button>
|
||||
</el-button-group>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -140,6 +143,7 @@ export default {
|
||||
);
|
||||
},
|
||||
searchByKeyword: function () {
|
||||
this.currentPage = 1;
|
||||
this.loadData();
|
||||
},
|
||||
boolFormatPublish (row, column) {
|
||||
|
@@ -182,27 +182,52 @@
|
||||
:value="item"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="只创建表"
|
||||
<el-form-item label="自动同步模式"
|
||||
label-width="240px"
|
||||
:required=true
|
||||
prop="targetOnlyCreate"
|
||||
prop="autoSyncMode"
|
||||
style="width:65%">
|
||||
<span slot="label">
|
||||
<span style="color: red"><strong>自动同步模式</strong> </span>
|
||||
</span>
|
||||
<el-tooltip placement="top">
|
||||
<div slot="content">
|
||||
只再目标端创建表,不同步数据内容;如果配置为“是”,则下面的“数据处理批次大小"将无效。
|
||||
<p>如果只同步数据内容,则需要目标端需要存在符合映射规则的物理表,可在执行任务前手动建好;</p>
|
||||
</div>
|
||||
<i class="el-icon-question"></i>
|
||||
</el-tooltip>
|
||||
<el-select v-model="createform.targetOnlyCreate">
|
||||
<el-select v-model="createform.autoSyncMode">
|
||||
<el-option label='目标端建表并同步数据'
|
||||
:value=2></el-option>
|
||||
<el-option label='目标端只创建物理表'
|
||||
:value=1></el-option>
|
||||
<el-option label='目标端只同步表里数据'
|
||||
:value=0></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="建表字段自增"
|
||||
label-width="240px"
|
||||
:required=true
|
||||
v-if=" createform.autoSyncMode!==0 "
|
||||
prop="targetAutoIncrement"
|
||||
style="width:65%">
|
||||
<el-tooltip placement="top">
|
||||
<div slot="content">
|
||||
创建表时是否自动支持字段的自增;只有使用自动建表才会生效,不过前提需要两端的数据库表支持自增字段,默认为false。
|
||||
</div>
|
||||
<i class="el-icon-question"></i>
|
||||
</el-tooltip>
|
||||
<el-select v-model="createform.targetAutoIncrement">
|
||||
<el-option label='是'
|
||||
:value=true></el-option>
|
||||
<el-option label='否'
|
||||
:value=false></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="数据处理批次大小"
|
||||
<el-form-item label="数据批次大小"
|
||||
label-width="240px"
|
||||
:required=true
|
||||
v-if=" createform.autoSyncMode!==1 "
|
||||
prop="batchSize"
|
||||
style="width:65%">
|
||||
<el-tooltip placement="top">
|
||||
@@ -225,6 +250,7 @@
|
||||
<el-form-item label="表名大小写转换"
|
||||
label-width="240px"
|
||||
:required=true
|
||||
v-if=" createform.autoSyncMode!==0 "
|
||||
prop="tableNameCase"
|
||||
style="width:45%">
|
||||
<el-tooltip placement="top">
|
||||
@@ -245,6 +271,7 @@
|
||||
<el-form-item label="列名大小写转换"
|
||||
label-width="240px"
|
||||
:required=true
|
||||
v-if=" createform.autoSyncMode!==0 "
|
||||
prop="columnNameCase"
|
||||
style="width:45%">
|
||||
<el-tooltip placement="top">
|
||||
@@ -381,9 +408,23 @@
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="目地端数据源">[{{createform.targetConnectionId}}]{{targetConnection.name}}</el-descriptions-item>
|
||||
<el-descriptions-item label="目地端schema">{{createform.targetSchema}}</el-descriptions-item>
|
||||
<el-descriptions-item label="只创建表">{{createform.targetOnlyCreate}}</el-descriptions-item>
|
||||
<el-descriptions-item label="数据处理批次量">{{createform.batchSize}}</el-descriptions-item>
|
||||
<el-descriptions-item label="表名大小写转换">
|
||||
<el-descriptions-item label="自动同步模式">
|
||||
<span v-if="createform.autoSyncMode == 2">
|
||||
目标端建表并同步数据
|
||||
</span>
|
||||
<span v-if="createform.autoSyncMode == 1">
|
||||
目标端只创建物理表
|
||||
</span>
|
||||
<span v-if="createform.autoSyncMode == 0">
|
||||
目标端只同步表里数据
|
||||
</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="建表字段自增"
|
||||
v-if=" createform.autoSyncMode!==0 ">{{createform.targetAutoIncrement}}</el-descriptions-item>
|
||||
<el-descriptions-item label="数据批次大小"
|
||||
v-if=" createform.autoSyncMode!==1 ">{{createform.batchSize}}</el-descriptions-item>
|
||||
<el-descriptions-item label="表名大小写转换"
|
||||
v-if=" createform.autoSyncMode!==0 ">
|
||||
<span v-if="createform.tableNameCase == 'NONE'">
|
||||
无转换
|
||||
</span>
|
||||
@@ -394,7 +435,8 @@
|
||||
转小写
|
||||
</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="列名大小写转换">
|
||||
<el-descriptions-item label="列名大小写转换"
|
||||
v-if=" createform.autoSyncMode!==0 ">
|
||||
<span v-if="createform.columnNameCase == 'NONE'">
|
||||
无转换
|
||||
</span>
|
||||
@@ -535,6 +577,8 @@ export default {
|
||||
targetConnectionId: '请选择',
|
||||
targetDropTable: true,
|
||||
targetOnlyCreate: false,
|
||||
targetAutoIncrement: false,
|
||||
autoSyncMode: 2,
|
||||
targetSchema: "",
|
||||
batchSize: 5000
|
||||
},
|
||||
@@ -879,6 +923,16 @@ export default {
|
||||
|
||||
},
|
||||
handleSave: function () {
|
||||
if (0 === this.createform.autoSyncMode) {
|
||||
this.createform.targetDropTable = false;
|
||||
this.createform.targetOnlyCreate = false;
|
||||
} else if (1 === this.createform.autoSyncMode) {
|
||||
this.createform.targetDropTable = true;
|
||||
this.createform.targetOnlyCreate = true;
|
||||
} else {
|
||||
this.createform.targetDropTable = true;
|
||||
this.createform.targetOnlyCreate = false;
|
||||
}
|
||||
this.$refs['createform'].validate(valid => {
|
||||
if (valid) {
|
||||
this.$http({
|
||||
@@ -904,8 +958,9 @@ export default {
|
||||
columnNameMapper: this.createform.columnNameMapper,
|
||||
tableNameCase: this.createform.tableNameCase,
|
||||
columnNameCase: this.createform.columnNameCase,
|
||||
targetDropTable: true,
|
||||
targetDropTable: this.createform.targetDropTable,
|
||||
targetOnlyCreate: this.createform.targetOnlyCreate,
|
||||
targetAutoIncrement: this.createform.targetAutoIncrement,
|
||||
batchSize: this.createform.batchSize
|
||||
}
|
||||
})
|
||||
|
@@ -2,7 +2,6 @@
|
||||
<el-card>
|
||||
<el-form :model="updateform"
|
||||
status-icon
|
||||
:rules="rules"
|
||||
ref="updateform">
|
||||
<el-descriptions size="small"
|
||||
:column="1"
|
||||
@@ -20,7 +19,7 @@
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item v-if="updateform.scheduleMode == 'SYSTEM_SCHEDULED'"
|
||||
label="CRON表达式">{{updateform.cronExpression}}</el-descriptions-item>
|
||||
<el-descriptions-item label="源端数据源">[{{updateform.sourceConnectionId}}]{{sourceConnection.name}}</el-descriptions-item>
|
||||
<el-descriptions-item label="源端数据源">[{{updateform.sourceConnectionId}}]{{updateform.sourceConnectionName}}</el-descriptions-item>
|
||||
<el-descriptions-item label="源端schema">{{updateform.sourceSchema}}</el-descriptions-item>
|
||||
<el-descriptions-item label="源端表类型">{{updateform.tableType}}</el-descriptions-item>
|
||||
<el-descriptions-item label="源端表选择方式">
|
||||
@@ -36,12 +35,25 @@
|
||||
<p v-for="item in updateform.sourceTables"
|
||||
v-bind:key="item">{{item}}</p>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="目地端数据源">[{{updateform.targetConnectionId}}]{{targetConnection.name}}</el-descriptions-item>
|
||||
<el-descriptions-item label="目地端数据源">[{{updateform.targetConnectionId}}]{{updateform.targetConnectionName}}</el-descriptions-item>
|
||||
<el-descriptions-item label="目地端schema">{{updateform.targetSchema}}</el-descriptions-item>
|
||||
<el-descriptions-item label="只创建表">{{updateform.targetOnlyCreate}}</el-descriptions-item>
|
||||
<el-descriptions-item label="删除同名表">{{updateform.targetDropTable}}</el-descriptions-item>
|
||||
<el-descriptions-item label="数据处理批次量">{{updateform.batchSize}}</el-descriptions-item>
|
||||
<el-descriptions-item label="表名大小写转换">
|
||||
<el-descriptions-item label="自动同步模式">
|
||||
<span v-if="updateform.autoSyncMode == 2">
|
||||
目标端建表并同步数据
|
||||
</span>
|
||||
<span v-if="updateform.autoSyncMode == 1">
|
||||
目标端只创建物理表
|
||||
</span>
|
||||
<span v-if="updateform.autoSyncMode == 0">
|
||||
目标端只同步表里数据
|
||||
</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="建表字段自增"
|
||||
v-if=" updateform.autoSyncMode!==0 ">{{updateform.targetAutoIncrement}}</el-descriptions-item>
|
||||
<el-descriptions-item label="数据批次大小"
|
||||
v-if=" updateform.autoSyncMode!==1 ">{{updateform.batchSize}}</el-descriptions-item>
|
||||
<el-descriptions-item label="表名大小写转换"
|
||||
v-if=" updateform.autoSyncMode!==0 ">
|
||||
<span v-if="updateform.tableNameCase == 'NONE'">
|
||||
无转换
|
||||
</span>
|
||||
@@ -52,7 +64,8 @@
|
||||
转小写
|
||||
</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="列名大小写转换">
|
||||
<el-descriptions-item label="列名大小写转换"
|
||||
v-if=" updateform.autoSyncMode!==0 ">
|
||||
<span v-if="updateform.columnNameCase == 'NONE'">
|
||||
无转换
|
||||
</span>
|
||||
@@ -97,6 +110,7 @@
|
||||
|
||||
</el-form>
|
||||
<el-button type="primary"
|
||||
size="mini"
|
||||
icon="el-icon-arrow-left"
|
||||
@click="handleGoBack">
|
||||
返回
|
||||
@@ -127,6 +141,7 @@ export default {
|
||||
targetConnectionId: '请选择',
|
||||
targetDropTable: true,
|
||||
targetOnlyCreate: false,
|
||||
autoSyncMode: 2,
|
||||
targetSchema: "",
|
||||
batchSize: 5000
|
||||
},
|
||||
@@ -144,6 +159,14 @@ export default {
|
||||
).then(res => {
|
||||
if (0 === res.data.code) {
|
||||
let detail = res.data.data;
|
||||
let varAutoSyncMode = 2;
|
||||
if (detail.configuration.targetDropTable && detail.configuration.targetOnlyCreate) {
|
||||
varAutoSyncMode = 1;
|
||||
} else if (!detail.configuration.targetDropTable && !detail.configuration.targetOnlyCreate) {
|
||||
varAutoSyncMode = 0;
|
||||
} else {
|
||||
varAutoSyncMode = 2;
|
||||
}
|
||||
this.updateform = {
|
||||
id: detail.id,
|
||||
name: detail.name,
|
||||
@@ -151,6 +174,7 @@ export default {
|
||||
scheduleMode: detail.scheduleMode,
|
||||
cronExpression: detail.cronExpression,
|
||||
sourceConnectionId: detail.configuration.sourceConnectionId,
|
||||
sourceConnectionName: detail.configuration.sourceConnectionName,
|
||||
sourceSchema: detail.configuration.sourceSchema,
|
||||
tableType: detail.configuration.tableType,
|
||||
includeOrExclude: detail.configuration.includeOrExclude,
|
||||
@@ -160,8 +184,11 @@ export default {
|
||||
tableNameCase: detail.configuration.tableNameCase,
|
||||
columnNameCase: detail.configuration.columnNameCase,
|
||||
targetConnectionId: detail.configuration.targetConnectionId,
|
||||
targetConnectionName: detail.configuration.targetConnectionName,
|
||||
targetDropTable: detail.configuration.targetDropTable,
|
||||
targetOnlyCreate: detail.configuration.targetOnlyCreate,
|
||||
targetAutoIncrement: detail.configuration.targetAutoIncrement,
|
||||
autoSyncMode: varAutoSyncMode,
|
||||
targetSchema: detail.configuration.targetSchema,
|
||||
batchSize: detail.configuration.batchSize
|
||||
}
|
||||
|
@@ -8,7 +8,7 @@
|
||||
<span>任务安排列表</span>
|
||||
<el-input placeholder="请输入关键字搜索"
|
||||
v-model="keyword"
|
||||
clearable=true
|
||||
:clearable=true
|
||||
@change="changeSearchKeyword"
|
||||
style="width:200px">
|
||||
</el-input>
|
||||
@@ -33,6 +33,14 @@
|
||||
</el-card>
|
||||
|
||||
<div class="contentBox">
|
||||
<div class="right-refresh-button">
|
||||
<el-button type="primary"
|
||||
plain
|
||||
size="mini"
|
||||
icon="el-icon-refresh"
|
||||
@click="handleClickRefresh"
|
||||
round>刷新</el-button>
|
||||
</div>
|
||||
<el-table :header-cell-style="{background:'#eef1f6',color:'#606266'}"
|
||||
:data="jobTableData"
|
||||
size="small"
|
||||
@@ -61,10 +69,11 @@
|
||||
<el-table-column label="日志"
|
||||
min-width="15%">
|
||||
<template slot-scope="props">
|
||||
<el-button size="small"
|
||||
type="danger"
|
||||
@click="handleShowJobLogs(props.row.jobId)">
|
||||
查看
|
||||
<el-button size="mini"
|
||||
type="success"
|
||||
@click="handleShowJobLogs(props.row.jobId)"
|
||||
round>
|
||||
<i class="el-icon-view el-icon--right">查看</i>
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -155,7 +164,7 @@ export default {
|
||||
keyword: null,
|
||||
pageTaskAssignments: [],
|
||||
pageTaskAssignmentsTotalCount: 0,
|
||||
taskId: '请选择一个任务安排',
|
||||
taskId: 0,
|
||||
jobTableData: [],
|
||||
jobScheduleTime: '',
|
||||
isActive: -1,
|
||||
@@ -194,6 +203,7 @@ export default {
|
||||
);
|
||||
},
|
||||
changeSearchKeyword: function () {
|
||||
this.currentTaskAssignmentPage = 1;
|
||||
this.loadPageTaskAssignments();
|
||||
},
|
||||
handleLoadPageTaskAssignments: function (currentPage) {
|
||||
@@ -236,6 +246,13 @@ export default {
|
||||
this.taskId = taskId;
|
||||
this.loadJobsData();
|
||||
},
|
||||
handleClickRefresh () {
|
||||
if (!this.taskId || this.taskId < 0) {
|
||||
alert("请先在左侧选择一个任务来");
|
||||
return;
|
||||
}
|
||||
this.loadJobsData();
|
||||
},
|
||||
handleCancelJob: function (jobId) {
|
||||
this.$http.get(
|
||||
"/dbswitch/admin/api/v1/ops/job/cancel?id=" + jobId
|
||||
@@ -401,4 +418,10 @@ export default {
|
||||
padding: 10px;
|
||||
width: calc(100% - 250px);
|
||||
}
|
||||
|
||||
.right-refresh-button {
|
||||
float: right;
|
||||
margin-right: 2px;
|
||||
margin: 10px 2px;
|
||||
}
|
||||
</style>
|
||||
|
@@ -181,47 +181,52 @@
|
||||
:value="item"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="只创建表"
|
||||
<el-form-item label="自动同步模式"
|
||||
label-width="240px"
|
||||
:required=true
|
||||
prop="targetOnlyCreate"
|
||||
style="width:65%">
|
||||
<el-tooltip placement="top">
|
||||
<div slot="content">
|
||||
只再目标端创建表,不同步数据内容;如果配置为“是”,则下面的“数据处理批次大小"将无效。
|
||||
</div>
|
||||
<i class="el-icon-question"></i>
|
||||
</el-tooltip>
|
||||
<el-select v-model="updateform.targetOnlyCreate">
|
||||
<el-option label='是'
|
||||
:value=true></el-option>
|
||||
<el-option label='否'
|
||||
:value=false></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label-width="240px"
|
||||
:required=true
|
||||
prop="targetDropTable"
|
||||
prop="autoSyncMode"
|
||||
style="width:65%">
|
||||
<span slot="label">
|
||||
<span style="color: red"><strong>删除同名表</strong> </span>
|
||||
<span style="color: red"><strong>自动同步模式</strong> </span>
|
||||
</span>
|
||||
<el-tooltip placement="top">
|
||||
<div slot="content">
|
||||
当目标端存在同名表时,如果配置为“是”,则会删除同步表后再进行创建。如果修改了表或字段的映射关系,请将配置为“是”,否则任务执行时会因映射关系不匹配而报错。
|
||||
<p>如果只同步数据内容,则需要目标端需要存在符合映射规则的物理表,可在执行任务前手动建好;</p>
|
||||
</div>
|
||||
<i class="el-icon-question"></i>
|
||||
</el-tooltip>
|
||||
<el-select v-model="updateform.targetDropTable">
|
||||
<el-select v-model="updateform.autoSyncMode">
|
||||
<el-option label='目标端建表并同步数据'
|
||||
:value=2></el-option>
|
||||
<el-option label='目标端只创建物理表'
|
||||
:value=1></el-option>
|
||||
<el-option label='目标端只同步表里数据'
|
||||
:value=0></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="建表字段自增"
|
||||
label-width="240px"
|
||||
:required=true
|
||||
v-if=" updateform.autoSyncMode!==0 "
|
||||
prop="targetAutoIncrement"
|
||||
style="width:65%">
|
||||
<el-tooltip placement="top">
|
||||
<div slot="content">
|
||||
创建表时是否自动支持字段的自增;只有使用自动建表才会生效,不过前提需要两端的数据库表支持自增字段,默认为false。
|
||||
</div>
|
||||
<i class="el-icon-question"></i>
|
||||
</el-tooltip>
|
||||
<el-select v-model="updateform.targetAutoIncrement">
|
||||
<el-option label='是'
|
||||
:value=true></el-option>
|
||||
<el-option label='否'
|
||||
:value=false></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="数据处理批次大小"
|
||||
<el-form-item label="数据批次大小"
|
||||
label-width="240px"
|
||||
:required=true
|
||||
v-if=" updateform.autoSyncMode!==1 "
|
||||
prop="batchSize"
|
||||
style="width:65%">
|
||||
<el-tooltip placement="top">
|
||||
@@ -244,6 +249,7 @@
|
||||
<el-form-item label="表名大小写转换"
|
||||
label-width="240px"
|
||||
:required=true
|
||||
v-if=" updateform.autoSyncMode!==0 "
|
||||
prop="tableNameCase"
|
||||
style="width:45%">
|
||||
<el-tooltip placement="top">
|
||||
@@ -264,6 +270,7 @@
|
||||
<el-form-item label="列名大小写转换"
|
||||
label-width="240px"
|
||||
:required=true
|
||||
v-if=" updateform.autoSyncMode!==0 "
|
||||
prop="columnNameCase"
|
||||
style="width:45%">
|
||||
<el-tooltip placement="top">
|
||||
@@ -382,7 +389,7 @@
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item v-if="updateform.scheduleMode == 'SYSTEM_SCHEDULED'"
|
||||
label="CRON表达式">{{updateform.cronExpression}}</el-descriptions-item>
|
||||
<el-descriptions-item label="源端数据源">[{{updateform.sourceConnectionId}}]{{sourceConnection.name}}</el-descriptions-item>
|
||||
<el-descriptions-item label="源端数据源">[{{updateform.sourceConnectionId}}]{{updateform.sourceConnectionName}}</el-descriptions-item>
|
||||
<el-descriptions-item label="源端schema">{{updateform.sourceSchema}}</el-descriptions-item>
|
||||
<el-descriptions-item label="源端表类型">{{updateform.tableType}}</el-descriptions-item>
|
||||
<el-descriptions-item label="源端表选择方式">
|
||||
@@ -398,12 +405,22 @@
|
||||
<p v-for="item in updateform.sourceTables"
|
||||
v-bind:key="item">{{item}}</p>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="目地端数据源">[{{updateform.targetConnectionId}}]{{targetConnection.name}}</el-descriptions-item>
|
||||
<el-descriptions-item label="目地端数据源">[{{updateform.targetConnectionId}}]{{updateform.targetConnectionName}}</el-descriptions-item>
|
||||
<el-descriptions-item label="目地端schema">{{updateform.targetSchema}}</el-descriptions-item>
|
||||
<el-descriptions-item label="只创建表">{{updateform.targetOnlyCreate}}</el-descriptions-item>
|
||||
<el-descriptions-item label="删除同名表">{{updateform.targetDropTable}}</el-descriptions-item>
|
||||
<el-descriptions-item label="数据处理批次量">{{updateform.batchSize}}</el-descriptions-item>
|
||||
<el-descriptions-item label="表名大小写转换">
|
||||
<el-descriptions-item label="自动同步模式">
|
||||
<span v-if="updateform.autoSyncMode == 2">
|
||||
目标端建表并同步数据
|
||||
</span>
|
||||
<span v-if="updateform.autoSyncMode == 1">
|
||||
目标端只创建物理表
|
||||
</span>
|
||||
<span v-if="updateform.autoSyncMode == 0">
|
||||
目标端只同步表里数据
|
||||
</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="建表字段自增" v-if=" updateform.autoSyncMode!==0 ">{{updateform.targetAutoIncrement}}</el-descriptions-item>
|
||||
<el-descriptions-item label="数据批次大小" v-if=" updateform.autoSyncMode!==1 ">{{updateform.batchSize}}</el-descriptions-item>
|
||||
<el-descriptions-item label="表名大小写转换" v-if=" updateform.autoSyncMode!==0 ">
|
||||
<span v-if="updateform.tableNameCase == 'NONE'">
|
||||
无转换
|
||||
</span>
|
||||
@@ -414,7 +431,7 @@
|
||||
转小写
|
||||
</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="列名大小写转换">
|
||||
<el-descriptions-item label="列名大小写转换" v-if=" updateform.autoSyncMode!==0 ">
|
||||
<span v-if="updateform.columnNameCase == 'NONE'">
|
||||
无转换
|
||||
</span>
|
||||
@@ -561,6 +578,8 @@ export default {
|
||||
targetConnectionId: '请选择',
|
||||
targetDropTable: true,
|
||||
targetOnlyCreate: false,
|
||||
targetAutoIncrement: false,
|
||||
autoSyncMode: 2,
|
||||
targetSchema: "",
|
||||
batchSize: 5000
|
||||
},
|
||||
@@ -703,6 +722,14 @@ export default {
|
||||
).then(res => {
|
||||
if (0 === res.data.code) {
|
||||
let detail = res.data.data;
|
||||
let varAutoSyncMode = 2;
|
||||
if (detail.configuration.targetDropTable && detail.configuration.targetOnlyCreate) {
|
||||
varAutoSyncMode = 1;
|
||||
} else if (!detail.configuration.targetDropTable && !detail.configuration.targetOnlyCreate) {
|
||||
varAutoSyncMode = 0;
|
||||
} else {
|
||||
varAutoSyncMode = 2;
|
||||
}
|
||||
this.updateform = {
|
||||
id: detail.id,
|
||||
name: detail.name,
|
||||
@@ -710,6 +737,7 @@ export default {
|
||||
scheduleMode: detail.scheduleMode,
|
||||
cronExpression: detail.cronExpression,
|
||||
sourceConnectionId: detail.configuration.sourceConnectionId,
|
||||
sourceConnectionName: detail.configuration.sourceConnectionName,
|
||||
sourceSchema: detail.configuration.sourceSchema,
|
||||
tableType: detail.configuration.tableType,
|
||||
includeOrExclude: detail.configuration.includeOrExclude,
|
||||
@@ -719,8 +747,11 @@ export default {
|
||||
tableNameCase: detail.configuration.tableNameCase,
|
||||
columnNameCase: detail.configuration.columnNameCase,
|
||||
targetConnectionId: detail.configuration.targetConnectionId,
|
||||
targetConnectionName: detail.configuration.targetConnectionName,
|
||||
targetDropTable: detail.configuration.targetDropTable,
|
||||
targetOnlyCreate: detail.configuration.targetOnlyCreate,
|
||||
targetAutoIncrement: detail.configuration.targetAutoIncrement,
|
||||
autoSyncMode: varAutoSyncMode,
|
||||
targetSchema: detail.configuration.targetSchema,
|
||||
batchSize: detail.configuration.batchSize
|
||||
}
|
||||
@@ -958,6 +989,17 @@ export default {
|
||||
|
||||
},
|
||||
handleSave: function () {
|
||||
if (0 === this.updateform.autoSyncMode) {
|
||||
this.updateform.targetDropTable = false;
|
||||
this.updateform.targetOnlyCreate = false;
|
||||
} else if (1 === this.updateform.autoSyncMode) {
|
||||
this.updateform.targetDropTable = true;
|
||||
this.updateform.targetOnlyCreate = true;
|
||||
} else {
|
||||
this.updateform.targetDropTable = true;
|
||||
this.updateform.targetOnlyCreate = false;
|
||||
}
|
||||
|
||||
this.$refs['updateform'].validate(valid => {
|
||||
if (valid) {
|
||||
this.$http({
|
||||
|
Reference in New Issue
Block a user