feat(gather): 添加数据同步功能

- 在池子管理页面添加同步操作按钮
- 实现同步操作的逻辑,包括确认对话框和成功/失败提示
- 新增 syncDB 函数用于执行同步操作

Signed-off-by: 1iyc <5212514+liycone@user.noreply.gitee.com>
main
1iyc 3 weeks ago
parent 6bbd88b817
commit 3487278628

@ -12,7 +12,19 @@ export function getNav(query) {
export function getTasks(queryParams) {
return request({
url: '/gather/task/page',
method: 'GET',
method: 'get',
params: queryParams,
});
}
export function syncDB(tableName, dataSource) {
return request({
url: '/gather/task/sync',
method: 'post',
params: {
dataSource: dataSource,
tableName: tableName,
}
})
}

@ -22,7 +22,7 @@
</template>
<script>
import {getNav, getTasks} from "@/api/gather/pool/pool";
import {getNav, getTasks, syncDB} from "@/api/gather/pool/pool";
export default {
name: 'App',
@ -197,9 +197,17 @@ export default {
},
//
handleSync(row) {
console.log('同步操作:', row);
//
},
const tableName = row.tableName;
const dataSource = this.queryParams.name;
this.$modal.confirm(`确认要强制同步"${row.tableName}"表结构吗?`).then(() => {
return syncDB(tableName, dataSource);
}).then(() => {
this.$modal.msgSuccess("同步成功");
}).catch(e => {
console.error('同步失败:', e);
this.$modal.msgError("同步失败,请检查日志");
})
}
}
};
</script>

Loading…
Cancel
Save