| | |
| | | import type { VbenFormApi, VbenFormSchema } from '#/adapter/form'; |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | import { z } from '#/adapter/form'; |
| | | import { getSimpleUserListByRoleCode } from '#/api/system/user'; |
| | | import { getTemplatePage } from '#/api/mes/pro/processdesign/template'; |
| | | import { getUserListByWorkstationId } from '#/api/mes/md/workstation/worker'; |
| | | import type { MesProTaskApi } from '#/api/mes/pro/task'; |
| | | import type { MesProWorkOrderApi } from '#/api/mes/pro/workorder'; |
| | |
| | | /** 待排产订单列表的字段 */ |
| | | export function useGridColumns(): VxeTableGridOptions<MesProWorkOrderApi.WorkOrder>['columns'] { |
| | | return [ |
| | | { type: 'checkbox', width: 48, fixed: 'left' }, |
| | | { |
| | | field: 'code', |
| | | title: '订单编码', |
| | |
| | | }, |
| | | }, |
| | | { |
| | | field: 'productionStatus', |
| | | title: '生产状态', |
| | | width: 100, |
| | | cellRender: { |
| | | name: 'CellDict', |
| | | props: { type: DICT_TYPE.ORDER_PRODUCTION_STATUS }, |
| | | }, |
| | | }, |
| | | { |
| | | field: 'quantity', |
| | | title: '订单数量', |
| | | width: 100, |
| | |
| | | width: 100, |
| | | }, |
| | | { |
| | | field: 'clientCode', |
| | | title: '客户编码', |
| | | width: 120, |
| | | field: 'progressPercent', |
| | | title: '完成进度', |
| | | width: 150, |
| | | slots: { default: 'progressPercent' }, |
| | | }, |
| | | { |
| | | field: 'clientName', |
| | |
| | | |
| | | { |
| | | title: '操作', |
| | | width: 160, |
| | | width: 240, |
| | | fixed: 'right', |
| | | slots: { default: 'actions' }, |
| | | }, |
| | |
| | | width: 120, |
| | | }, |
| | | { |
| | | field: 'paramTemplateId', |
| | | title: '工艺参数模板', |
| | | minWidth: 140, |
| | | formatter: ({ cellValue }) => cellValue ? `模板 #${cellValue}` : '未配置', |
| | | }, |
| | | { |
| | | field: 'quantity', |
| | | title: '排产数量', |
| | | width: 100, |
| | |
| | | /** 生产任务新增/修改的表单 */ |
| | | export function useTaskFormSchema(formApi?: VbenFormApi, workOrderQuantity?: Ref<number | undefined>): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | fieldName: 'paramTemplateId', |
| | | label: '工艺参数模板', |
| | | component: 'ApiSelect', |
| | | componentProps: { |
| | | api: () => getTemplatePage({ pageNo: 1, pageSize: 100 }), |
| | | labelField: 'templateName', |
| | | valueField: 'id', |
| | | resultField: 'list', |
| | | allowClear: true, |
| | | placeholder: '请选择工艺参数模板', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'workstationId', |
| | | label: '工作站', |
| | |
| | | async function recalcDuration(formApi?: VbenFormApi) { |
| | | if (!formApi) return; |
| | | const values = await formApi.getValues(); |
| | | |
| | | |
| | | if (values.workstationId) { |
| | | try { |
| | | const users = await getUserListByWorkstationId({ workstationId: values.workstationId }); |