index.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <template>
  2. <PageWrapper dense contentFullHeight fixedHeight contentClass="flex">
  3. <div class="page-dsion">
  4. <div class="page-dsion-header">
  5. <Steps :percent="60" :current="state.stepIndex" :items="state.stepItems" type="navigation">
  6. <Steps.Step v-for="(item, index) in state.stepItems" :key="index">
  7. <template #title>{{ item.title }}</template>
  8. </Steps.Step>
  9. </Steps>
  10. </div>
  11. <div class="page-dsion-body">
  12. <DsionStep1 ref="dsionStep1Ref" :taskId="taskId" v-show="state.stepIndex === 0" />
  13. <DsionStep6 ref="dsionStep6Ref" :taskId="taskId" v-show="state.stepIndex === 1" />
  14. <DsionStep2 ref="dsionStep2Ref" :taskId="taskId" v-show="state.stepIndex === 2" />
  15. <DsionStep3 ref="dsionStep3Ref" :taskId="taskId" v-show="state.stepIndex === 3" />
  16. <DsionStep4 ref="dsionStep4Ref" :taskId="taskId" v-show="state.stepIndex === 4" />
  17. <DsionStep5 v-show="state.stepIndex === 5" />
  18. </div>
  19. <div class="page-dsion-floor">
  20. <a-button v-show="state.stepIndex !== 0" @click="handleStep(0)" class="ml-[24px]">
  21. 上一步
  22. </a-button>
  23. <a-button
  24. v-show="state.stepIndex !== 5"
  25. type="primary"
  26. @click="handleStep(1)"
  27. class="ml-[24px]"
  28. >
  29. 下一步
  30. </a-button>
  31. <a-button
  32. v-show="state.stepIndex === 5"
  33. type="primary"
  34. class="ml-[24px]"
  35. @click="handleSubmit"
  36. >
  37. 提交
  38. </a-button>
  39. </div>
  40. </div>
  41. </PageWrapper>
  42. </template>
  43. <script setup lang="ts">
  44. import { PageWrapper } from '/@/components/Page';
  45. import { Steps } from 'ant-design-vue';
  46. import { reactive, onMounted, ref } from 'vue';
  47. import DsionStep1 from './components/DsionStep1.vue';
  48. import DsionStep2 from './components/DsionStep2.vue';
  49. import DsionStep3 from './components/DsionStep3.vue';
  50. import DsionStep4 from './components/DsionStep4.vue';
  51. import DsionStep5 from './components/DsionStep5.vue';
  52. import DsionStep6 from './components/DsionStep6.vue';
  53. defineProps({
  54. taskId: { type: String, default: '' },
  55. });
  56. const dsionStep1Ref = ref<ElRef>(null);
  57. const dsionStep2Ref = ref<ElRef>(null);
  58. const dsionStep3Ref = ref<ElRef>(null);
  59. const dsionStep4Ref = ref<ElRef>(null);
  60. const dsionStep6Ref = ref<ElRef>(null);
  61. const state = reactive({
  62. stepIndex: 0,
  63. stepItems: [
  64. { title: '分班规则' },
  65. { title: '专业条件' },
  66. { title: '班级配置' },
  67. { title: '自动分班' },
  68. { title: '班级调整' },
  69. { title: '分班确认' },
  70. ],
  71. });
  72. const handleSubmit = () => {};
  73. const handleStep = async (type) => {
  74. if (type == 1) {
  75. const isOk = await stepValidate[state.stepIndex]();
  76. if (!isOk) {
  77. return;
  78. }
  79. state.stepIndex += 1;
  80. await stepReload[state.stepIndex]();
  81. } else {
  82. state.stepIndex -= 1;
  83. }
  84. };
  85. const stepValidate = {
  86. 0: () => dsionStep1Ref.value.validateStep(),
  87. 1: () => dsionStep6Ref.value.validateStep(),
  88. 2: () => dsionStep2Ref.value.validateStep(),
  89. 3: () => dsionStep3Ref.value.validateStep(),
  90. 4: () => dsionStep4Ref.value.validateStep(),
  91. };
  92. const stepReload = {
  93. 0: () => dsionStep1Ref.value.reloadStep(),
  94. 1: () => dsionStep6Ref.value.reloadStep(),
  95. 2: () => dsionStep2Ref.value.reloadStep(),
  96. 3: () => dsionStep3Ref.value.reloadStep(),
  97. 4: () => dsionStep4Ref.value.reloadStep(),
  98. };
  99. onMounted(async () => {});
  100. </script>
  101. <style lang="less" scoped>
  102. .page-dsion {
  103. width: 100%;
  104. height: 100%;
  105. &-header {
  106. margin: 0 auto;
  107. background-color: @component-background;
  108. padding: 8px 16px;
  109. border-radius: 16px;
  110. }
  111. &-body {
  112. height: calc(100% - 80px - 60px);
  113. display: flex;
  114. }
  115. &-floor {
  116. height: 60px;
  117. background-color: @component-background;
  118. align-items: center;
  119. display: flex;
  120. justify-content: end;
  121. padding-right: 16px;
  122. }
  123. }
  124. </style>