liu
10 天以前 70b7935fc261cd5e8eaaf1cfbc8078b04db576d2
src/views/mes/pro/route/data.ts
@@ -26,7 +26,7 @@
  MdProductBomSelect,
} from '#/views/mes/md/item/components';
import { RouteColorPicker } from './components';
import { RouteColorPicker, RouteOutputAttribution } from './components';
/** 表单类型 */
export type FormType = 'create' | 'detail' | 'update';
@@ -183,7 +183,7 @@
/** 工艺路线工序明细表单 */
export function useRouteProcessFormSchema(
  processOptions: Array<{ label: string; value: number }>,
  productIds: number[] = [],
  products: MesProRouteProductApi.RouteProduct[] = [],
): VbenFormSchema[] {
  return [
    {
@@ -220,13 +220,11 @@
      rules: 'selectRequired',
    },
    {
      fieldName: 'outputItemIds',
      fieldName: 'outputs',
      label: '本工序产出',
      component: markRaw(MdItemSelect),
      component: markRaw(RouteOutputAttribution),
      componentProps: {
        multiple: true,
        productIds,
        placeholder: '可留空;形成半成品时选择,末道工序选择全部成品',
        products,
      },
      formItemClass: 'col-span-2',
    },
@@ -318,7 +316,25 @@
    { field: 'sort', title: '序号', width: 70, align: 'center', fixed: 'left' },
    { field: 'processCode', title: '工序编码', width: 140, fixed: 'left' },
    { field: 'processName', title: '工序名称', width: 140, fixed: 'left' },
    { field: 'outputItemNames', title: '本工序产出', minWidth: 190 },
    {
      field: 'outputItemNames',
      title: '本工序产出',
      minWidth: 240,
      formatter: ({ cellValue, row }) => {
        const outputs = row.outputs ?? [];
        if (!outputs.length) {
          return cellValue ?? '';
        }
        return outputs
          .map((output) => {
            const name = output.itemName ?? output.itemCode ?? output.itemId;
            return output.productId == null
              ? `${name}(通用)`
              : `${name}(${output.productName ?? output.productId})`;
          })
          .join('、');
      },
    },
    { field: 'nextProcessName', title: '下一道工序', width: 140 },
    {
      field: 'linkType',
@@ -379,6 +395,7 @@
  return [
    { field: 'itemCode', title: '产出编码', width: 150 },
    { field: 'itemName', title: '产出名称', width: 150 },
    { field: 'templateReference', title: '模板引用', width: 100, slots: { default: 'templateReference' } },
    { field: 'specification', title: '规格型号', width: 150 },
    { field: 'unitName', title: '单位', width: 80 },
    { field: 'quantity', title: '生产数量', width: 100 },