spring
2026-07-03 081f242ea3c019f4eddd0fe342c5cf6189da1468
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
<script lang="ts" setup>
import type { MesPdWorkflowApi } from '#/api/mes/pd/workflow';
 
import { onMounted, ref, watch } from 'vue';
 
import { Steps } from 'ant-design-vue';
 
import { getPdWorkflowList } from '#/api/mes/pd/workflow';
 
const props = defineProps<{
  projectId: number;
}>();
 
const loading = ref(false);
const nodes = ref<MesPdWorkflowApi.WorkflowNode[]>([]);
const current = ref(0);
 
async function loadData() {
  loading.value = true;
  try {
    nodes.value = await getPdWorkflowList(props.projectId);
    const activeIndex = nodes.value.findIndex((item) => item.status !== 1);
    current.value = activeIndex === -1 ? nodes.value.length : activeIndex;
  } finally {
    loading.value = false;
  }
}
 
watch(
  () => props.projectId,
  () => loadData(),
  { immediate: true },
);
 
onMounted(loadData);
</script>
 
<template>
  <Steps :current="current" direction="vertical" size="small">
    <Steps.Step
      v-for="node in nodes"
      :key="node.id"
      :description="node.remark"
      :sub-title="node.operatorName"
      :title="node.nodeName"
    />
    <Steps.Step
      v-if="!loading && nodes.length === 0"
      description="暂无流程记录,保存项目后将自动生成"
      title="待启动"
    />
  </Steps>
</template>