3 天以前 06f3df285a24234e60883cd5ae73c6153abf4155
src/views/mes/pro/task/data.ts
@@ -1,5 +1,8 @@
import type { VbenFormApi, VbenFormSchema } from '#/adapter/form';
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 type { MesProTaskApi } from '#/api/mes/pro/task';
import type { MesProWorkOrderApi } from '#/api/mes/pro/workorder';
@@ -161,6 +164,12 @@
      field: 'quantityProduced',
      title: '已生产数量',
      width: 100,
    },
    {
      field: 'progressPercent',
      title: '完成进度',
      width: 150,
      slots: { default: 'progressPercent' },
    },
    {
      field: 'clientCode',
@@ -345,6 +354,12 @@
      width: 120,
    },
    {
      field: 'paramTemplateId',
      title: '工艺参数模板',
      minWidth: 140,
      formatter: ({ cellValue }) => cellValue ? `模板 #${cellValue}` : '未配置',
    },
    {
      field: 'quantity',
      title: '排产数量',
      width: 100,
@@ -391,8 +406,21 @@
}
/** 生产任务新增/修改的表单 */
export function useTaskFormSchema(formApi?: VbenFormApi, workOrderQuantity?: Ref<number | undefined>): VbenFormSchema[] {
export function useTaskFormSchema(formApi?: VbenFormApi, workOrderQuantity?: Ref<number | undefined>, feedbackRole?: Ref<string | 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: '工作站',
@@ -468,6 +496,20 @@
      },
    },
    {
      fieldName: 'assigneeUserIds',
      label: '报工人',
      component: 'ApiSelect',
      componentProps: {
        placeholder: '请选择报工人',
        api: getSimpleUserListByRoleCode,
        params: { code: feedbackRole?.value || 'production_submit_work' },
        labelField: 'nickname',
        valueField: 'id',
        mode: 'multiple',
      },
      rules: z.array(z.number()).min(1, '请选择报工人').default([]),
    },
    {
      fieldName: 'remark',
      label: '备注',
      component: 'Textarea',