车间能级提升-智能设备管理系统
朱桂飞
2025-01-09 3e8f7f239bedae0b4f04a1ac6bd443ba6298f73c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<script setup lang="ts">
import type { GenInfo } from '#/api/tool/gen/model';
 
import { onMounted, provide, ref } from 'vue';
import { useRoute } from 'vue-router';
 
import { Page } from '@vben/common-ui';
import { useTabs } from '@vben/hooks';
import { safeParseNumber } from '@vben/utils';
 
import { Skeleton, Step, Steps } from 'ant-design-vue';
 
import { genInfo } from '#/api/tool/gen';
 
import { BasicSetting, GenConfig, GenSuccess } from './edit-steps';
import { emitter } from './mitt';
 
const current = ref(0);
 
const { setTabTitle } = useTabs();
const routes = useRoute();
// 获取路由参数
const tableId = routes.params.tableId as string;
 
const genInfoData = ref<GenInfo['info']>();
 
provide('genInfoData', genInfoData);
 
onMounted(async () => {
  const resp = await genInfo(tableId);
  // 需要做菜单转换 严格相等 才能选中回显
  resp.info.parentMenuId = safeParseNumber(resp.info.parentMenuId);
  genInfoData.value = resp.info;
  setTabTitle(`生成配置: ${resp.info.tableName}`);
});
 
/**
 * 事件总线 监听切换步骤
 */
emitter.on('to', (step: number) => {
  current.value = step;
});
</script>
 
<template>
  <Page content-class="bg-background p-5 rounded-lg">
    <div class="flex items-center justify-center">
      <Steps :current="current" class="w-fit">
        <Step title="生成信息" />
        <Step disabled title="字段信息" />
        <Step disabled title="完成" />
      </Steps>
    </div>
    <!-- content -->
    <div v-if="genInfoData">
      <BasicSetting v-if="current === 0" />
      <GenConfig v-if="current === 1" />
      <GenSuccess v-if="current === 2" />
    </div>
    <Skeleton v-else :active="true" />
  </Page>
</template>