bugfix
This commit is contained in:
@ -14,3 +14,11 @@ export const createTables = (tenantId) => {
|
||||
method: "POST",
|
||||
});
|
||||
};
|
||||
|
||||
// /tenant/init/initData/{tenantId}
|
||||
export const initData = (tenantId) => {
|
||||
return request({
|
||||
url: `/tenant/init/initData/${tenantId}`,
|
||||
method: "POST",
|
||||
});
|
||||
}
|
@ -143,20 +143,42 @@
|
||||
</el-row>
|
||||
</div>
|
||||
<template v-else-if="activeStep === 2">
|
||||
<el-alert :closable="false" show-icon type="error"
|
||||
<el-alert v-if="currentStepStatus === 0" :closable="false" show-icon type="error"
|
||||
>错误码: {{ createTablesResult.result }}, 错误信息:
|
||||
{{ createTablesResult.msg }}</el-alert
|
||||
{{ createTablesResult.msg }}
|
||||
</el-alert
|
||||
>
|
||||
<el-row justify="center" style="margin-top: 24px">
|
||||
<el-col :span="1.5">
|
||||
<div class="circle-button" @click="activeStep = 3">步骤2</div>
|
||||
<div
|
||||
v-if="currentStepStatus === 0"
|
||||
class="circle-button error"
|
||||
@click="router.push({ path: '/tenant/tenant' })"
|
||||
>
|
||||
关闭
|
||||
</div>
|
||||
<div v-else-if="currentStepStatus === 2" class="circle-button" @click="importData">导入数据</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</template>
|
||||
<template v-else-if="activeStep === 3">
|
||||
<el-row justify="center">
|
||||
<el-alert v-if="currentStepStatus === 0" :closable="false" show-icon type="error"
|
||||
>错误码: {{ initDataResult.result }}, 错误信息:
|
||||
{{ initDataResult.msg }}
|
||||
</el-alert
|
||||
>
|
||||
<el-row justify="center" style="margin-top: 24px">
|
||||
<el-col :span="1.5">
|
||||
<div class="circle-button" @click="activeStep = 4">步骤3</div>
|
||||
<div
|
||||
v-if="currentStepStatus === 0"
|
||||
class="circle-button error"
|
||||
@click="router.push({ path: '/tenant/tenant' })"
|
||||
>
|
||||
关闭
|
||||
</div>
|
||||
<div v-else-if="currentStepStatus===2" class="circle-button finish"
|
||||
@click="router.push({ path: '/tenant/tenant' })">完成
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</template>
|
||||
@ -165,7 +187,7 @@
|
||||
</template>
|
||||
<script setup>
|
||||
import {onMounted, reactive, ref, toRefs, watchEffect} from "vue";
|
||||
import { check, createTables } from "@/api/tenant/init";
|
||||
import {check, createTables, initData} from "@/api/tenant/init";
|
||||
import {useRoute, useRouter} from "vue-router";
|
||||
import {tenantModeDict} from "@/constant/dict";
|
||||
|
||||
@ -184,9 +206,10 @@ if (route.query.id) {
|
||||
const data = reactive({
|
||||
tenantInitCheckResult: {},
|
||||
createTablesResult: {},
|
||||
initDataResult: {},
|
||||
});
|
||||
|
||||
const { tenantInitCheckResult, createTablesResult } = toRefs(data);
|
||||
const {tenantInitCheckResult, createTablesResult, initDataResult} = toRefs(data);
|
||||
const tenantInitCheck = () => {
|
||||
activeStep.value = 1;
|
||||
currentStepStatus.value = 1;
|
||||
@ -197,10 +220,13 @@ const tenantInitCheck = () => {
|
||||
} else {
|
||||
currentStepStatus.value = 0;
|
||||
}
|
||||
}).catch(() => {
|
||||
currentStepStatus.value = 2;
|
||||
activeStep.value = 2;
|
||||
});
|
||||
};
|
||||
|
||||
// 创建数据库
|
||||
// 第二步: 创建数据库
|
||||
const createDatabase = () => {
|
||||
activeStep.value = 2;
|
||||
currentStepStatus.value = 1;
|
||||
@ -211,6 +237,26 @@ const createDatabase = () => {
|
||||
} else {
|
||||
currentStepStatus.value = 0;
|
||||
}
|
||||
}).catch(() => {
|
||||
currentStepStatus.value = 2;
|
||||
activeStep.value = 2;
|
||||
});
|
||||
};
|
||||
|
||||
// 第三步,导入数据
|
||||
const importData = () => {
|
||||
activeStep.value = 3;
|
||||
currentStepStatus.value = 1;
|
||||
initData(tenantId.value).then((resp) => {
|
||||
initDataResult.value = resp;
|
||||
if (resp.result === 200) {
|
||||
currentStepStatus.value = 2;
|
||||
} else {
|
||||
currentStepStatus.value = 0;
|
||||
}
|
||||
}).catch(() => {
|
||||
currentStepStatus.value = 2;
|
||||
activeStep.value = 2;
|
||||
});
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user