xiaoyi
8 天以前 286619b69e4004c6bcaff4cb19a40b77b053453d
src/views/bpm/model/form/index.vue
@@ -59,6 +59,10 @@
const actionType = route.params.type as string; // 操作类型:create、copy、update
const currentStep = ref(-1); // 步骤控制。-1 用于,一开始全部不展示等当前页面数据初始化完成
const processVisited = ref(false);
watch(currentStep, (step) => {
  if (step === 2) processVisited.value = true;
}, { flush: 'sync' });
const steps = [
  { title: '基本信息', validator: validateBasic },
  { title: '表单设计', validator: validateForm },
@@ -251,6 +255,11 @@
  // 流程设计校验
  try {
    if (!processDesignRef.value) {
      currentStep.value = 2;
      message.warning('请先检查流程设计');
      return false;
    }
    await validateProcess();
  } catch {
    currentStep.value = 2;
@@ -335,7 +344,7 @@
    }
    deployLoading.value = true;
    // 1.2 校验所有步骤
    await validateAllSteps();
    if (!(await validateAllSteps())) return;
    // 2.1 更新表单数据
    const modelData = {
@@ -345,8 +354,7 @@
    if (formData.value.id) {
      await updateModel(modelData);
    } else {
      const result = await createModel(modelData);
      formData.value.id = result.id;
      formData.value.id = await createModel(modelData);
    }
    // 2.3 发布
    await deployModel(formData.value.id);
@@ -480,7 +488,7 @@
      <Card :body-style="{ padding: '10px' }" class="mb-4">
        <div class="mt-12">
          <!-- 第一步:基本信息 -->
          <div v-if="currentStep === 0" class="mx-auto w-4/6">
          <div v-if="currentStep >= 0" v-show="currentStep === 0" class="mx-auto w-4/6">
            <BasicInfo
              v-model="formData"
              :category-list="categoryList"
@@ -490,7 +498,7 @@
            />
          </div>
          <!-- 第二步:表单设计  -->
          <div v-if="currentStep === 1" class="mx-auto w-4/6">
          <div v-if="currentStep >= 0" v-show="currentStep === 1" class="mx-auto w-4/6">
            <FormDesign
              v-model="formData"
              :form-list="formList"
@@ -500,7 +508,9 @@
          <!-- 第三步:流程设计 -->
          <ProcessDesign
            v-if="currentStep === 2"
            v-if="processVisited"
            v-show="currentStep === 2"
            :active="currentStep === 2"
            v-model="formData"
            ref="processDesignRef"
          />