feat: 详情组件, 实例文件
This commit is contained in:
105
src/components/steps/index.vue
Normal file
105
src/components/steps/index.vue
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
<template>
|
||||||
|
<div class="steps-box">
|
||||||
|
<el-steps :active="localActive">
|
||||||
|
<el-step
|
||||||
|
v-for="(item, index) in localSteps"
|
||||||
|
:key="item.key"
|
||||||
|
:title="item.title"
|
||||||
|
:class="stepClass(index)"
|
||||||
|
@click="handleStep(item.key, index)"
|
||||||
|
></el-step>
|
||||||
|
</el-steps>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 步骤内容 -->
|
||||||
|
<div>
|
||||||
|
<template v-for="(item, index) in stepList" :key="item.key" >
|
||||||
|
<component v-show="localActive == index" :is="item.component"/>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="jsx">
|
||||||
|
import { ElNotification } from 'element-plus';
|
||||||
|
import { computed, ref, watchEffect } from 'vue';
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
// 步骤对应内容list
|
||||||
|
stepList: {
|
||||||
|
type: Array,
|
||||||
|
default: []
|
||||||
|
},
|
||||||
|
// 当前显示步骤
|
||||||
|
active: {
|
||||||
|
type: Number,
|
||||||
|
default: 0
|
||||||
|
},
|
||||||
|
// 已完成的工作流步骤
|
||||||
|
stepSuccess: {
|
||||||
|
type: Array,
|
||||||
|
default: [0]
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const emits = defineEmits(['stepChange'])
|
||||||
|
|
||||||
|
const localActive = ref(0) // 当前激活步骤
|
||||||
|
const localSteps = ref([
|
||||||
|
{
|
||||||
|
title: '需求征集',
|
||||||
|
key: 'collect',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '需求上报',
|
||||||
|
key: 'report',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '项目立项',
|
||||||
|
key: 'approve',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '项目实施',
|
||||||
|
key: 'execute',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '项目归档',
|
||||||
|
key: 'archivist',
|
||||||
|
},
|
||||||
|
])
|
||||||
|
|
||||||
|
const stepClass = (val) => {
|
||||||
|
if(props.stepSuccess.includes(val)) {
|
||||||
|
return 'step-success'
|
||||||
|
}
|
||||||
|
return 'step-error'
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleStep = (key, index) => {
|
||||||
|
if(props.stepSuccess.includes(index)) {
|
||||||
|
localActive.value = index
|
||||||
|
emits('stepChange', {key, active: index})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
ElNotification({
|
||||||
|
title: '提示',
|
||||||
|
message: '不能查看未完成的工作流信息',
|
||||||
|
type: 'warning'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
watchEffect(()=>{
|
||||||
|
localActive.value = props.active
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.steps-box{
|
||||||
|
padding: 10px 0;
|
||||||
|
}
|
||||||
|
.step-success {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.step-error {
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
17
src/views/steps/step/Step1.vue
Normal file
17
src/views/steps/step/Step1.vue
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
步骤1
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { onMounted } from 'vue';
|
||||||
|
|
||||||
|
onMounted(()=>{
|
||||||
|
console.log('步骤一挂载');
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
17
src/views/steps/step/Step2.vue
Normal file
17
src/views/steps/step/Step2.vue
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
步骤2
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { onMounted } from 'vue';
|
||||||
|
|
||||||
|
onMounted(()=>{
|
||||||
|
console.log('步骤一挂载');
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
17
src/views/steps/step/Step3.vue
Normal file
17
src/views/steps/step/Step3.vue
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
步骤1
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { onMounted } from 'vue';
|
||||||
|
|
||||||
|
onMounted(()=>{
|
||||||
|
console.log('步骤一挂载');
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
17
src/views/steps/step/Step4.vue
Normal file
17
src/views/steps/step/Step4.vue
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
步骤1
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { onMounted } from 'vue';
|
||||||
|
|
||||||
|
onMounted(()=>{
|
||||||
|
console.log('步骤一挂载');
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
17
src/views/steps/step/Step5.vue
Normal file
17
src/views/steps/step/Step5.vue
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
步骤1
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { onMounted } from 'vue';
|
||||||
|
|
||||||
|
onMounted(()=>{
|
||||||
|
console.log('步骤1-5挂载');
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
39
src/views/steps/step/index.vue
Normal file
39
src/views/steps/step/index.vue
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
<template>
|
||||||
|
<steps :stepList="stepList" :stepSuccess="[0,1]"></steps>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="jsx">
|
||||||
|
import { reactive, shallowRef } from 'vue';
|
||||||
|
import fvSelect from '@/fvcomponents/fvSelect/index.vue'
|
||||||
|
import Step1 from './Step1.vue'
|
||||||
|
import Step2 from './Step2.vue'
|
||||||
|
import Step3 from './Step3.vue'
|
||||||
|
import Step4 from './Step4.vue'
|
||||||
|
import Step5 from './Step5.vue'
|
||||||
|
const stepList = reactive([
|
||||||
|
{
|
||||||
|
key: 'collect',
|
||||||
|
component: markRaw(Step1)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'report',
|
||||||
|
component: markRaw(Step2)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'approve',
|
||||||
|
component: markRaw(Step3)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'execute',
|
||||||
|
component: markRaw(Step4)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'archivist',
|
||||||
|
component: markRaw(Step5)
|
||||||
|
},
|
||||||
|
])
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
Reference in New Issue
Block a user