| | |
| | | import type { VbenFormApi, VbenFormSchema } from '#/adapter/form'; |
| | | import type { VbenFormApi, VbenFormSchema } from '#/adapter/form'; |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | import type { MesMdProductBomApi } from '#/api/mes/md/item/productBom'; |
| | | import type { MesProWorkOrderApi } from '#/api/mes/pro/workorder'; |
| | |
| | | }, |
| | | { |
| | | fieldName: 'status', |
| | | label: '工单状态', |
| | | label: '订单状态', |
| | | component: 'Select', |
| | | componentProps: { |
| | | disabled: true, |
| | |
| | | }, |
| | | { |
| | | fieldName: 'code', |
| | | label: '工单编码', |
| | | label: '订单编码', |
| | | component: 'Input', |
| | | componentProps: { |
| | | disabled: headerReadonly, |
| | | placeholder: '请输入工单编码', |
| | | placeholder: '请输入订单编码', |
| | | }, |
| | | rules: 'required', |
| | | suffix: |
| | |
| | | }, |
| | | { |
| | | fieldName: 'name', |
| | | label: '工单名称', |
| | | label: '订单名称', |
| | | component: 'Input', |
| | | componentProps: { |
| | | disabled: headerReadonly, |
| | | placeholder: '请输入工单名称', |
| | | placeholder: '请输入订单名称', |
| | | }, |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'orderSourceType', |
| | | label: '工单来源', |
| | | label: '订单来源', |
| | | component: 'Select', |
| | | componentProps: { |
| | | disabled: headerReadonly, |
| | |
| | | DICT_TYPE.MES_PRO_WORK_ORDER_SOURCE_TYPE, |
| | | 'number', |
| | | ), |
| | | placeholder: '请选择工单来源', |
| | | // 工单来源变更:非客户订单时清空来源单据编号和客户 |
| | | placeholder: '请选择订单来源', |
| | | // 订单来源变更:非客户订单时清空来源单据编号和客户 |
| | | onChange: async (value: number) => { |
| | | if (value !== MesProWorkOrderSourceTypeEnum.ORDER) { |
| | | await formApi?.setValues({ |
| | |
| | | }, |
| | | { |
| | | fieldName: 'type', |
| | | label: '工单类型', |
| | | label: '订单类型', |
| | | component: 'Select', |
| | | componentProps: { |
| | | disabled: headerReadonly, |
| | | options: getDictOptions(DICT_TYPE.MES_PRO_WORK_ORDER_TYPE, 'number'), |
| | | placeholder: '请选择工单类型', |
| | | // 工单类型变更:非代工/采购时清空供应商 |
| | | placeholder: '请选择订单类型', |
| | | // 订单类型变更:非代工/采购时清空供应商 |
| | | onChange: async (value: number) => { |
| | | if ( |
| | | value !== MesProWorkOrderTypeEnum.OUTSOURCE && |
| | |
| | | }, |
| | | { |
| | | fieldName: 'quantity', |
| | | label: '工单数量', |
| | | label: '订单数量', |
| | | component: 'InputNumber', |
| | | componentProps: { |
| | | class: '!w-full', |
| | | disabled: headerReadonly, |
| | | min: 1, |
| | | placeholder: '请输入工单数量', |
| | | placeholder: '请输入订单数量', |
| | | precision: 2, |
| | | }, |
| | | rules: 'required', |
| | |
| | | return [ |
| | | { |
| | | fieldName: 'code', |
| | | label: '工单编码', |
| | | label: '订单编码', |
| | | component: 'Input', |
| | | componentProps: { |
| | | allowClear: true, |
| | | placeholder: '请输入工单编码', |
| | | placeholder: '请输入订单编码', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'name', |
| | | label: '工单名称', |
| | | label: '订单名称', |
| | | component: 'Input', |
| | | componentProps: { |
| | | allowClear: true, |
| | | placeholder: '请输入工单名称', |
| | | placeholder: '请输入订单名称', |
| | | }, |
| | | }, |
| | | { |
| | |
| | | }, |
| | | { |
| | | fieldName: 'type', |
| | | label: '工单类型', |
| | | label: '订单类型', |
| | | component: 'Select', |
| | | componentProps: { |
| | | allowClear: true, |
| | | options: getDictOptions(DICT_TYPE.MES_PRO_WORK_ORDER_TYPE, 'number'), |
| | | placeholder: '请选择工单类型', |
| | | placeholder: '请选择订单类型', |
| | | }, |
| | | }, |
| | | { |
| | |
| | | return [ |
| | | { |
| | | field: 'code', |
| | | title: '工单编码', |
| | | title: '订单编码', |
| | | fixed: 'left', |
| | | width: 200, |
| | | treeNode: true, |
| | |
| | | }, |
| | | { |
| | | field: 'name', |
| | | title: '工单名称', |
| | | title: '订单名称', |
| | | minWidth: 150, |
| | | }, |
| | | { |
| | | field: 'type', |
| | | title: '工单类型', |
| | | title: '订单类型', |
| | | width: 100, |
| | | cellRender: { |
| | | name: 'CellDict', |
| | |
| | | }, |
| | | { |
| | | field: 'orderSourceType', |
| | | title: '工单来源', |
| | | title: '订单来源', |
| | | width: 100, |
| | | cellRender: { |
| | | name: 'CellDict', |
| | |
| | | }, |
| | | { |
| | | field: 'quantity', |
| | | title: '工单数量', |
| | | title: '订单数量', |
| | | width: 100, |
| | | }, |
| | | { |
| | |
| | | }, |
| | | { |
| | | field: 'status', |
| | | title: '工单状态', |
| | | title: '订单状态', |
| | | width: 100, |
| | | cellRender: { |
| | | name: 'CellDict', |
| | |
| | | ]; |
| | | } |
| | | |
| | | /** 工单 BOM 子表的字段 */ |
| | | /** 订单 BOM 子表的字段 */ |
| | | export function useBomGridColumns( |
| | | editable: boolean, |
| | | generatable: boolean, |
| | |
| | | ]; |
| | | } |
| | | |
| | | /** 工单 BOM 新增/修改的表单 */ |
| | | /** 订单 BOM 新增/修改的表单 */ |
| | | export function useBomFormSchema( |
| | | isCreate: boolean, |
| | | productId?: number, |
| | |
| | | ]; |
| | | } |
| | | |
| | | /** 工单选择弹窗的搜索表单 */ |
| | | /** 订单选择弹窗的搜索表单 */ |
| | | export function useWorkOrderSelectGridFormSchema(): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | fieldName: 'code', |
| | | label: '工单编码', |
| | | label: '订单编码', |
| | | component: 'Input', |
| | | componentProps: { |
| | | allowClear: true, |
| | | placeholder: '请输入工单编码', |
| | | placeholder: '请输入订单编码', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'name', |
| | | label: '工单名称', |
| | | label: '订单名称', |
| | | component: 'Input', |
| | | componentProps: { |
| | | allowClear: true, |
| | | placeholder: '请输入工单名称', |
| | | placeholder: '请输入订单名称', |
| | | }, |
| | | }, |
| | | { |
| | |
| | | }, |
| | | { |
| | | fieldName: 'status', |
| | | label: '工单状态', |
| | | label: '订单状态', |
| | | component: 'Select', |
| | | componentProps: { |
| | | allowClear: true, |
| | | options: getDictOptions(DICT_TYPE.MES_PRO_WORK_ORDER_STATUS, 'number'), |
| | | placeholder: '请选择工单状态', |
| | | placeholder: '请选择订单状态', |
| | | }, |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** 工单选择弹窗的字段 */ |
| | | /** 订单选择弹窗的字段 */ |
| | | export function useWorkOrderSelectGridColumns( |
| | | multiple = false, |
| | | ): VxeTableGridOptions<MesProWorkOrderApi.WorkOrder>['columns'] { |
| | |
| | | }, |
| | | { |
| | | field: 'code', |
| | | title: '工单编码', |
| | | title: '订单编码', |
| | | width: 180, |
| | | }, |
| | | { |
| | | field: 'name', |
| | | title: '工单名称', |
| | | title: '订单名称', |
| | | minWidth: 180, |
| | | }, |
| | | { |
| | | field: 'orderSourceType', |
| | | title: '工单来源', |
| | | title: '订单来源', |
| | | width: 100, |
| | | cellRender: { |
| | | name: 'CellDict', |
| | |
| | | }, |
| | | { |
| | | field: 'quantity', |
| | | title: '工单数量', |
| | | title: '订单数量', |
| | | width: 100, |
| | | }, |
| | | { |
| | |
| | | }, |
| | | { |
| | | field: 'status', |
| | | title: '工单状态', |
| | | title: '订单状态', |
| | | width: 100, |
| | | cellRender: { |
| | | name: 'CellDict', |
| | |
| | | ]; |
| | | } |
| | | |
| | | /** 工单物料需求子表的字段(只读) */ |
| | | /** 订单物料需求子表的字段(只读) */ |
| | | export function useItemGridColumns(): VxeTableGridOptions<MesProWorkOrderBomApi.WorkOrderBom>['columns'] { |
| | | return [ |
| | | { |