| | |
| | | |
| | | import { h, markRaw } from 'vue'; |
| | | |
| | | import { |
| | | DICT_TYPE, |
| | | MesAutoCodeRuleCode, |
| | | MesProTaskStatusEnum, |
| | | MesProWorkOrderStatusEnum, |
| | | } from '@vben/constants'; |
| | | import { DICT_TYPE, MesAutoCodeRuleCode } from '@vben/constants'; |
| | | import { getDictOptions } from '@vben/hooks'; |
| | | |
| | | import { Button } from 'ant-design-vue'; |
| | |
| | | import { getTemplateItemOptionList } from '#/api/mes/qc/template/item'; |
| | | import { getSimpleUserList } from '#/api/system/user'; |
| | | import { getRangePickerDefaultProps } from '#/utils'; |
| | | import { MdItemSelect } from '#/views/mes/md/item/components'; |
| | | import { MdWorkstationSelect } from '#/views/mes/md/workstation/components'; |
| | | import { ProTaskSelect } from '#/views/mes/pro/task/components'; |
| | | import { ProWorkOrderSelect } from '#/views/mes/pro/workorder/components'; |
| | | import { MdmItemSelect } from '#/views/basicData/mdm/components'; |
| | | |
| | | /** 表单类型 */ |
| | | export type FormType = 'create' | 'detail' | 'update'; |
| | |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'workOrderId', |
| | | label: '生产订单', |
| | | component: markRaw(ProWorkOrderSelect), |
| | | fieldName: 'itemId', |
| | | label: '产品物料', |
| | | component: markRaw(MdmItemSelect), |
| | | componentProps: { |
| | | placeholder: '请选择生产订单', |
| | | status: MesProWorkOrderStatusEnum.CONFIRMED, |
| | | // 订单变更时清空生产任务 |
| | | onChange: () => formApi?.setFieldValue('taskId', undefined), |
| | | placeholder: '请选择产品物料', |
| | | }, |
| | | rules: 'selectRequired', |
| | | dependencies: { |
| | | triggerFields: ['sourceDocId'], |
| | | componentProps: (values) => ({ |
| | | disabled: !!values.sourceDocId, |
| | | placeholder: '请选择生产订单', |
| | | status: MesProWorkOrderStatusEnum.CONFIRMED, |
| | | onChange: () => formApi?.setFieldValue('taskId', undefined), |
| | | placeholder: '请选择产品物料', |
| | | }), |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'workstationId', |
| | | label: '工位', |
| | | component: markRaw(MdWorkstationSelect), |
| | | fieldName: 'batchCode', |
| | | label: '批号', |
| | | component: 'Input', |
| | | componentProps: { |
| | | placeholder: '请选择工位', |
| | | maxlength: 100, |
| | | placeholder: '请输入批号', |
| | | }, |
| | | rules: 'selectRequired', |
| | | dependencies: { |
| | | triggerFields: ['sourceDocId'], |
| | | componentProps: (values) => ({ |
| | | disabled: !!values.sourceDocId, |
| | | placeholder: '请选择工位', |
| | | }), |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'taskId', |
| | | label: '生产任务', |
| | | component: markRaw(ProTaskSelect), |
| | | componentProps: { |
| | | placeholder: '请选择生产任务', |
| | | statuses: [MesProTaskStatusEnum.PREPARE], |
| | | }, |
| | | dependencies: { |
| | | triggerFields: ['sourceDocId', 'workOrderId', 'workstationId'], |
| | | componentProps: (values) => ({ |
| | | disabled: !!values.sourceDocId || !values.workOrderId, |
| | | placeholder: '请选择生产任务', |
| | | statuses: [MesProTaskStatusEnum.PREPARE], |
| | | workOrderId: values.workOrderId, |
| | | workstationId: values.workstationId, |
| | | }), |
| | | }, |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'templateId', |
| | |
| | | }, |
| | | rules: 'selectRequired', |
| | | dependencies: { |
| | | triggerFields: ['workOrderId', 'taskId'], |
| | | triggerFields: ['itemId'], |
| | | componentProps: (values) => ({ |
| | | api: getTemplateItemOptionList, |
| | | autoSelect: 'first', |
| | | labelField: 'templateName', |
| | | valueField: 'templateId', |
| | | disabled: formType !== 'create' || !values.workOrderId, |
| | | params: values.workOrderId |
| | | ? { |
| | | qcType: 2, |
| | | workOrderId: values.workOrderId, |
| | | taskId: values.taskId, |
| | | } |
| | | : {}, |
| | | placeholder: values.workOrderId |
| | | ? '请选择质检方案' |
| | | : '请先选择生产订单', |
| | | disabled: formType !== 'create' || !values.itemId, |
| | | params: values.itemId ? { itemId: values.itemId, qcType: 2 } : {}, |
| | | placeholder: values.itemId ? '请选择质检方案' : '请先选择产品物料', |
| | | }), |
| | | }, |
| | | }, |
| | |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'workOrderId', |
| | | label: '生产订单', |
| | | component: markRaw(ProWorkOrderSelect), |
| | | fieldName: 'batchCode', |
| | | label: '批号', |
| | | component: 'Input', |
| | | componentProps: { |
| | | placeholder: '请选择生产订单', |
| | | allowClear: true, |
| | | placeholder: '请输入批号', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'itemId', |
| | | label: '产品物料', |
| | | component: markRaw(MdItemSelect), |
| | | component: markRaw(MdmItemSelect), |
| | | componentProps: { |
| | | placeholder: '请选择产品物料', |
| | | }, |
| | |
| | | }, |
| | | }, |
| | | { |
| | | field: 'workOrderCode', |
| | | title: '生产订单编号', |
| | | width: 140, |
| | | }, |
| | | { |
| | | field: 'itemCode', |
| | | title: '产品物料编码', |
| | | width: 130, |
| | |
| | | width: 130, |
| | | }, |
| | | { |
| | | field: 'batchCode', |
| | | title: '批号', |
| | | width: 140, |
| | | }, |
| | | { |
| | | field: 'unitName', |
| | | title: '单位', |
| | | width: 80, |