initdata timeout

This commit is contained in:
2023-07-07 17:38:20 +08:00
parent 9bf2d3c7f0
commit b84f94ea3a
4 changed files with 45 additions and 1 deletions

View File

@ -21,3 +21,11 @@ export const initData = (tenantId) => {
timeout: 0,
});
};
// 初始化完毕
export const initCompleted = (tenantId) => {
return request({
url: `/tenant/init/initCompleted/${tenantId}`,
method: "POST",
});
};

View File

@ -117,3 +117,11 @@ export function deleteDatasource(ids) {
method: "DELETE",
});
}
// 切换为主数据源
export const switchPrimary = (tenantId, id) => {
return request({
url: `/tenant/datasource/switchPrimary/${tenantId}/${id}`,
method: "PUT",
});
};

View File

@ -432,6 +432,16 @@
label="密码"
prop="password"
></el-table-column>
<el-table-column label="使用" align="center">
<template #default="{ row }">
<el-switch
active-value="1"
inactive-value="0"
:model-value="row.isPrimary"
@click="handleSwitchIsPrimary(row)"
/>
</template>
</el-table-column>
<el-table-column align="center" label="操作" width="140">
<template #default="{ row }">
<el-button
@ -482,6 +492,7 @@ import {
insertDatasource,
listTenant,
refreshCache,
switchPrimary,
tenantSetting,
updateDatasource,
updateTenant,
@ -880,6 +891,17 @@ function handleRefreshCache() {
});
}
/**
* 切换数据源使用状态
* @param row
*/
function handleSwitchIsPrimary(row) {
switchPrimary(tempTenantId.value, row.datasourceId).then(async () => {
const resp = await datasourceList(tempTenantId.value);
datasource.value = resp.data;
});
}
/**
* 前往初始化页面
*/

View File

@ -220,7 +220,12 @@
</template>
<script setup>
import { onMounted, reactive, ref, toRefs, watchEffect } from "vue";
import { check, createTables, initData } from "@/api/tenant/init";
import {
check,
createTables,
initCompleted,
initData,
} from "@/api/tenant/init";
import { useRoute, useRouter } from "vue-router";
import { tenant_mode_dict } from "@/constant/dict";
import { Refresh } from "@element-plus/icons-vue";
@ -317,6 +322,7 @@ const importData = () => {
initDataResult.value = resp;
if (resp.result === 200) {
currentStepStatus.value = 2;
initCompleted(tenantId.value);
} else {
currentStepStatus.value = 0;
throw new Error("导入数据失败");