| | |
| | | import { DICT_TYPE } from '@vben/constants'; |
| | | import { getDictOptions } from '@vben/hooks'; |
| | | |
| | | import { MdmItemSelect } from '#/views/basicData/mdm/components'; |
| | | import { ProLineSelect } from '#/views/mes/pro/line/components'; |
| | | import { UserSelect } from '#/views/system/user/components'; |
| | | import { getRangePickerDefaultProps } from '#/utils'; |
| | |
| | | /** 表单类型(fill:临时批次码补录正式信息) */ |
| | | export type FormType = 'create' | 'detail' | 'update' | 'fill'; |
| | | |
| | | /** 未绑定托盘下拉选项 */ |
| | | export interface PalletOption { |
| | | label: string; |
| | | value: number; |
| | | } |
| | | |
| | | /** 新增/修改的表单 */ |
| | | export function useFormSchema(formType: FormType): VbenFormSchema[] { |
| | | export function useFormSchema( |
| | | formType: FormType, |
| | | palletOptions: PalletOption[] = [], |
| | | ): VbenFormSchema[] { |
| | | const disabled = formType === 'detail'; |
| | | return [ |
| | | { |
| | |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'itemId', |
| | | label: '品种', |
| | | component: markRaw(MdmItemSelect), |
| | | fieldName: 'lineId', |
| | | label: '加工单位', |
| | | component: markRaw(ProLineSelect), |
| | | componentProps: { |
| | | disabled, |
| | | placeholder: '请选择品种(产品品种)', |
| | | placeholder: '请选择加工单位', |
| | | }, |
| | | rules: 'selectRequired', |
| | | }, |
| | | { |
| | | fieldName: 'lineId', |
| | | label: '产线', |
| | | component: markRaw(ProLineSelect), |
| | | fieldName: 'processingTeam', |
| | | label: '加工班组', |
| | | component: 'Input', |
| | | componentProps: { |
| | | allowClear: true, |
| | | disabled, |
| | | placeholder: '请选择产线', |
| | | maxlength: 64, |
| | | placeholder: '请输入加工班组', |
| | | }, |
| | | rules: 'selectRequired', |
| | | }, |
| | | { |
| | | fieldName: 'produceDate', |
| | |
| | | }, |
| | | { |
| | | fieldName: 'planQuantity', |
| | | label: '计划数量', |
| | | label: '加工数量', |
| | | component: 'InputNumber', |
| | | componentProps: { |
| | | class: '!w-full', |
| | | disabled, |
| | | min: 0, |
| | | placeholder: '请输入计划数量', |
| | | placeholder: '请输入加工数量', |
| | | precision: 2, |
| | | }, |
| | | }, |
| | |
| | | placeholder: '请选择责任人', |
| | | }, |
| | | rules: 'selectRequired', |
| | | }, |
| | | { |
| | | fieldName: 'palletIds', |
| | | label: '绑定托盘', |
| | | component: 'Select', |
| | | componentProps: { |
| | | allowClear: true, |
| | | disabled, |
| | | maxTagCount: 3, |
| | | mode: 'multiple', |
| | | optionFilterProp: 'label', |
| | | options: palletOptions, |
| | | placeholder: '请选择托盘(可不选)', |
| | | showSearch: true, |
| | | }, |
| | | dependencies: { |
| | | triggerFields: [''], |
| | | show: () => formType !== 'detail', |
| | | }, |
| | | help: '绑定后批次直接进入生产中:托盘生成正式托盘码,托盘下未录批次的袋码自动级联录入本批次(袋码品种须一致);编辑时仅需勾选新增托盘,已绑定的不可解绑', |
| | | }, |
| | | { |
| | | fieldName: 'remark', |
| | |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'itemId', |
| | | label: '品种', |
| | | component: markRaw(MdmItemSelect), |
| | | componentProps: { |
| | | placeholder: '请选择品种', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'lineCode', |
| | | label: '产线编码', |
| | | component: 'Input', |
| | | componentProps: { |
| | | allowClear: true, |
| | | placeholder: '请输入产线编码', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'lineName', |
| | | label: '产线名称', |
| | | label: '加工单位', |
| | | component: 'Input', |
| | | componentProps: { |
| | | allowClear: true, |
| | | placeholder: '请输入产线名称', |
| | | placeholder: '请输入加工单位', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'processingTeam', |
| | | label: '加工班组', |
| | | component: 'Input', |
| | | componentProps: { |
| | | allowClear: true, |
| | | placeholder: '请输入加工班组', |
| | | }, |
| | | }, |
| | | { |
| | |
| | | slots: { default: 'code' }, |
| | | }, |
| | | { |
| | | field: 'itemCode', |
| | | title: '品种编码', |
| | | field: 'lineName', |
| | | title: '加工单位', |
| | | width: 120, |
| | | }, |
| | | { |
| | | field: 'itemName', |
| | | title: '品种名称', |
| | | width: 140, |
| | | }, |
| | | { |
| | | field: 'lineCode', |
| | | title: '产线编码', |
| | | width: 100, |
| | | }, |
| | | { |
| | | field: 'lineName', |
| | | title: '产线名称', |
| | | field: 'processingTeam', |
| | | title: '加工班组', |
| | | width: 120, |
| | | }, |
| | | { |
| | |
| | | }, |
| | | { |
| | | field: 'planQuantity', |
| | | title: '计划数量', |
| | | title: '加工数量', |
| | | width: 100, |
| | | }, |
| | | { |