gaoluyang
2026-08-31 8f8dcdae7e40ba4e94a363aa8eb91c7665810bc3
src/views/mes/process-design/route/modules/process-form.vue
@@ -9,7 +9,7 @@
import { message } from 'ant-design-vue';
import { useVbenForm } from '#/adapter/form';
import { getProcessSimpleList } from '#/api/mes/pro/process';
import { getProcess, getProcessSimpleList } from '#/api/mes/pro/process';
import {
  createRouteProcess,
  getRouteProcess,
@@ -31,13 +31,26 @@
  commonConfig: {
    componentProps: { class: 'w-full' },
    formItemClass: 'col-span-1',
    labelWidth: 130,
    labelWidth: 150,
  },
  layout: 'horizontal',
  schema: [],
  showDefaultActions: false,
  wrapperClass: 'grid-cols-2',
});
/** 选择工序后,自动带出该工序配置的等待时长(直接填小时数,不换算) */
async function handleProcessChange(processId?: number) {
  if (!processId) {
    return;
  }
  try {
    const process = await getProcess(processId);
    await formApi.setFieldValue('waitTime', process.waitDuration ?? 0);
  } catch {
    // 工序详情获取失败时忽略反显
  }
}
/** 加载工序选项后再生成 schema(避免下拉空选项) */
async function loadSchema(): Promise<VbenFormSchema[]> {
@@ -46,7 +59,7 @@
    label: item.name ?? '',
    value: item.id!,
  }));
  return useRouteProcessFormSchema(options);
  return useRouteProcessFormSchema(options, handleProcessChange);
}
const [Modal, modalApi] = useVbenModal({