UnisKB/ui/src/views/dataset/CreateDataset.vue

97 lines
2.4 KiB
Vue
Raw Normal View History

2023-10-26 11:02:16 +00:00
<template>
2023-11-03 09:45:01 +00:00
<LayoutContainer header="创建数据集" back-to="-1" class="create-dataset">
<template #header>
<el-steps :active="active" finish-status="success" align-center class="create-dataset__steps">
<el-step v-for="(item, index) in steps" :key="index">
<template #icon>
<div class="app-step">
<div class="el-step__icon is-text">
<div class="el-step__icon-inner">{{ index + 1 }}</div>
</div>
{{ item.name }}
</div>
</template>
</el-step>
</el-steps>
</template>
2023-11-08 11:08:54 +00:00
<div class="create-dataset__main flex">
<div class="create-dataset__component">
2023-11-06 11:06:02 +00:00
<component :is="steps[active].component" :ref="steps[active]?.ref" />
2023-10-27 09:49:06 +00:00
</div>
2023-11-08 11:08:54 +00:00
</div>
<div class="create-dataset__footer text-right border-t">
<el-button @click="router.go(-1)"> </el-button>
2023-11-09 10:52:06 +00:00
<el-button @click="prev" v-if="active === 1"></el-button>
<el-button @click="next" type="primary" v-if="active === 0"></el-button>
<el-button @click="next" type="primary" v-if="active === 1"></el-button>
2023-10-27 09:49:06 +00:00
</div>
2023-11-03 09:45:01 +00:00
</LayoutContainer>
2023-10-26 11:02:16 +00:00
</template>
<script setup lang="ts">
import { ref } from 'vue'
2023-11-08 11:08:54 +00:00
import { useRouter } from 'vue-router'
2023-11-09 10:52:06 +00:00
import StepFirst from './step/StepFirst.vue'
import StepSecond from './step/StepSecond.vue'
2023-10-26 11:02:16 +00:00
2023-11-08 11:08:54 +00:00
const router = useRouter()
2023-10-27 09:49:06 +00:00
const steps = [
2023-11-06 11:06:02 +00:00
{
2023-11-09 10:52:06 +00:00
ref: 'StepFirstRef',
2023-11-06 11:06:02 +00:00
name: '上传文档',
2023-11-09 10:52:06 +00:00
component: StepFirst
2023-11-08 11:08:54 +00:00
},
{
ref: 'SetRulesRef',
name: '设置分段规则',
2023-11-09 10:52:06 +00:00
component: StepSecond
2023-10-27 09:49:06 +00:00
}
]
2023-11-09 10:52:06 +00:00
const StepFirstRef = ref()
2023-11-02 01:56:14 +00:00
const active = ref(0)
async function next() {
2023-11-09 10:52:06 +00:00
if (await StepFirstRef.value.onSubmit()) {
2023-11-02 01:56:14 +00:00
if (active.value++ > 2) active.value = 0
}
2023-10-26 11:02:16 +00:00
}
2023-11-08 11:08:54 +00:00
const prev = () => {
active.value = 0
}
2023-10-26 11:02:16 +00:00
</script>
2023-10-27 09:49:06 +00:00
<style lang="scss" scoped>
.create-dataset {
2023-11-03 09:45:01 +00:00
&__steps {
min-width: 450px;
max-width: 800px;
width: 80%;
margin: 0 auto;
padding-right: 60px;
:deep(.el-step__line) {
left: 64% !important;
right: -33% !important;
}
}
2023-10-27 09:49:06 +00:00
&__component {
2023-11-06 11:06:02 +00:00
width: 100%;
2023-11-08 11:08:54 +00:00
height: var(--create-dataset-height);
2023-10-27 09:49:06 +00:00
margin: 0 auto;
overflow: hidden;
2023-11-06 11:06:02 +00:00
box-sizing: border-box;
2023-10-27 09:49:06 +00:00
}
&__footer {
2023-11-08 11:08:54 +00:00
padding: 16px 24px;
position: fixed;
bottom: 0;
left: 0;
background: #ffffff;
width: 100%;
box-sizing: border-box;
2023-10-27 09:49:06 +00:00
}
}
</style>