| | |
| | | MdProductBomSelect, |
| | | } from '#/views/mes/md/item/components'; |
| | | |
| | | import { RouteColorPicker } from './components'; |
| | | import { RouteColorPicker, RouteOutputAttribution } from './components'; |
| | | |
| | | /** 表单类型 */ |
| | | export type FormType = 'create' | 'detail' | 'update'; |
| | |
| | | /** 工艺路线工序明细表单 */ |
| | | export function useRouteProcessFormSchema( |
| | | processOptions: Array<{ label: string; value: number }>, |
| | | productIds: number[] = [], |
| | | products: MesProRouteProductApi.RouteProduct[] = [], |
| | | ): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | |
| | | rules: 'selectRequired', |
| | | }, |
| | | { |
| | | fieldName: 'outputItemIds', |
| | | fieldName: 'outputs', |
| | | label: '本工序产出', |
| | | component: markRaw(MdItemSelect), |
| | | component: markRaw(RouteOutputAttribution), |
| | | componentProps: { |
| | | multiple: true, |
| | | productIds, |
| | | placeholder: '可留空;形成半成品时选择,末道工序选择全部成品', |
| | | products, |
| | | }, |
| | | formItemClass: 'col-span-2', |
| | | }, |
| | |
| | | { 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', |
| | |
| | | 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 }, |