bugfix
This commit is contained in:
@ -6,3 +6,11 @@ export const check = (tenantId) => {
|
|||||||
method: "POST",
|
method: "POST",
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// /tenant/init/createTables/{tenantId}
|
||||||
|
export const createTables = (tenantId) => {
|
||||||
|
return request({
|
||||||
|
url: `/tenant/init/createTables/${tenantId}`,
|
||||||
|
method: "POST",
|
||||||
|
});
|
||||||
|
};
|
||||||
|
@ -81,7 +81,7 @@ export const tenantModeDict = [
|
|||||||
elTagType: "primary",
|
elTagType: "primary",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "数据库",
|
label: "SCHEMA",
|
||||||
value: "2",
|
value: "2",
|
||||||
elTagType: "warning",
|
elTagType: "warning",
|
||||||
},
|
},
|
||||||
|
@ -38,7 +38,8 @@
|
|||||||
: 'success'
|
: 'success'
|
||||||
"
|
"
|
||||||
show-icon
|
show-icon
|
||||||
>{{ tenantInitCheckResult.msg }}
|
>错误码: {{ tenantInitCheckResult.result }}, 错误信息:
|
||||||
|
{{ tenantInitCheckResult.msg }}
|
||||||
</el-alert>
|
</el-alert>
|
||||||
<el-row style="margin-top: 36px">
|
<el-row style="margin-top: 36px">
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
@ -134,15 +135,19 @@
|
|||||||
<div
|
<div
|
||||||
v-else-if="currentStepStatus === 2"
|
v-else-if="currentStepStatus === 2"
|
||||||
class="circle-button"
|
class="circle-button"
|
||||||
@click=""
|
@click="createDatabase"
|
||||||
>
|
>
|
||||||
下一步
|
创建库
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
</div>
|
</div>
|
||||||
<template v-else-if="activeStep === 2">
|
<template v-else-if="activeStep === 2">
|
||||||
<el-row justify="center">
|
<el-alert :closable="false" show-icon type="error"
|
||||||
|
>错误码: {{ createTablesResult.result }}, 错误信息:
|
||||||
|
{{ createTablesResult.msg }}</el-alert
|
||||||
|
>
|
||||||
|
<el-row justify="center" style="margin-top: 24px">
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<div class="circle-button" @click="activeStep = 3">步骤2</div>
|
<div class="circle-button" @click="activeStep = 3">步骤2</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
@ -160,7 +165,7 @@
|
|||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onMounted, reactive, ref, toRefs, watchEffect } from "vue";
|
import { onMounted, reactive, ref, toRefs, watchEffect } from "vue";
|
||||||
import { check } from "@/api/tenant/init";
|
import { check, createTables } from "@/api/tenant/init";
|
||||||
import { useRoute, useRouter } from "vue-router";
|
import { useRoute, useRouter } from "vue-router";
|
||||||
import { tenantModeDict } from "@/constant/dict";
|
import { tenantModeDict } from "@/constant/dict";
|
||||||
|
|
||||||
@ -178,9 +183,10 @@ if (route.query.id) {
|
|||||||
|
|
||||||
const data = reactive({
|
const data = reactive({
|
||||||
tenantInitCheckResult: {},
|
tenantInitCheckResult: {},
|
||||||
|
createTablesResult: {},
|
||||||
});
|
});
|
||||||
|
|
||||||
const { tenantInitCheckResult } = toRefs(data);
|
const { tenantInitCheckResult, createTablesResult } = toRefs(data);
|
||||||
const tenantInitCheck = () => {
|
const tenantInitCheck = () => {
|
||||||
activeStep.value = 1;
|
activeStep.value = 1;
|
||||||
currentStepStatus.value = 1;
|
currentStepStatus.value = 1;
|
||||||
@ -193,6 +199,21 @@ const tenantInitCheck = () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 创建数据库
|
||||||
|
const createDatabase = () => {
|
||||||
|
activeStep.value = 2;
|
||||||
|
currentStepStatus.value = 1;
|
||||||
|
createTables(tenantId.value).then((resp) => {
|
||||||
|
createTablesResult.value = resp;
|
||||||
|
if (resp.result === 200) {
|
||||||
|
currentStepStatus.value = 2;
|
||||||
|
} else {
|
||||||
|
currentStepStatus.value = 0;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
watchEffect(() => {
|
watchEffect(() => {
|
||||||
const progressLineWidth =
|
const progressLineWidth =
|
||||||
@ -202,7 +223,7 @@ onMounted(() => {
|
|||||||
|
|
||||||
let progressLineColor;
|
let progressLineColor;
|
||||||
if (currentStepStatus.value === 0) {
|
if (currentStepStatus.value === 0) {
|
||||||
const percent = (activeStep.value - 1) / progressLineWidth;
|
const percent = ((activeStep.value - 1) / activeStep.value) * 100;
|
||||||
progressLineColor = `linear-gradient(to right, #67c23a ${percent}%, #f56c6c ${percent}%)`;
|
progressLineColor = `linear-gradient(to right, #67c23a ${percent}%, #f56c6c ${percent}%)`;
|
||||||
// 进度条颜色
|
// 进度条颜色
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user