src/views/mes/qc/iqc/data.ts
@@ -11,10 +11,12 @@
import { Button } from 'ant-design-vue';
import { generateAutoCode } from '#/api/mes/md/autocode/record';
import { getTemplateItemOptionList } from '#/api/mes/qc/template/item';
import { getSupplierSimpleList } from '#/api/srm/supplier';
import { getSimpleUserList } from '#/api/system/user';
import { getRangePickerDefaultProps } from '#/utils';
import { MdmItemSelect } from '#/views/basicData/mdm/components';
import { MdVendorSelect } from '#/views/mes/md/vendor/components';
/** 表单类型 */
export type FormType = 'create' | 'detail' | 'update';
@@ -134,18 +136,52 @@
      },
    },
    {
      fieldName: 'vendorId',
      label: '供应商',
      component: markRaw(MdVendorSelect),
      fieldName: 'templateId',
      label: '质检方案',
      component: 'ApiSelect',
      componentProps: {
        placeholder: '请选择供应商',
        api: getTemplateItemOptionList,
        autoSelect: 'first',
        labelField: 'templateName',
        valueField: 'templateId',
        placeholder: '请选择质检方案',
      },
      rules: 'selectRequired',
      dependencies: {
        triggerFields: ['itemId'],
        componentProps: (values) => ({
          api: getTemplateItemOptionList,
          autoSelect: 'first',
          labelField: 'templateName',
          valueField: 'templateId',
          disabled: formType !== 'create' || !values.itemId,
          params: values.itemId
            ? { itemId: values.itemId, qcType: 1 }
            : {},
          placeholder: values.itemId ? '请选择质检方案' : '请先选择产品物料',
        }),
      },
    },
    {
      fieldName: 'vendorId',
      label: '供应商',
      component: 'ApiSelect',
      componentProps: {
        allowClear: true,
        api: getSupplierSimpleList,
        labelField: 'name',
        placeholder: '请选择供应商',
        valueField: 'id',
      },
      dependencies: {
        triggerFields: ['sourceDocId'],
        componentProps: (values) => ({
          disabled: !!values.sourceDocId,
          allowClear: true,
          api: getSupplierSimpleList,
          labelField: 'name',
          placeholder: '请选择供应商',
          valueField: 'id',
        }),
      },
    },
@@ -200,6 +236,7 @@
        placeholder: '请输入不合格品数量',
      },
      rules: 'required',
      help: '不合格品数量大于0时,保存后将自动生成不合格处理单',
    },
    {
      fieldName: 'receiveDate',
@@ -208,7 +245,7 @@
      componentProps: {
        format: 'YYYY-MM-DD',
        placeholder: '请选择来料日期',
        valueFormat: 'x',
        valueFormat: 'YYYY-MM-DD',
      },
      rules: 'required',
    },
@@ -232,9 +269,60 @@
      componentProps: {
        format: 'YYYY-MM-DD',
        placeholder: '请选择检测日期',
        valueFormat: 'x',
        valueFormat: 'YYYY-MM-DD',
      },
      rules: 'required',
    },
    {
      fieldName: 'samplingLocation',
      label: '采样地点',
      component: 'Input',
      componentProps: {
        maxlength: 100,
        placeholder: '请输入采样地点',
      },
    },
    {
      fieldName: 'certificateNo',
      label: '证书编号',
      component: 'Input',
      componentProps: {
        maxlength: 50,
        placeholder: '请输入证书编号',
      },
    },
    {
      fieldName: 'executeStandard',
      label: '执行标准',
      component: 'Input',
      componentProps: {
        maxlength: 50,
        placeholder: '如 GB/T 6027,选择质检方案后自动带入',
      },
    },
    {
      fieldName: 'auditUserId',
      label: '复核人',
      component: 'ApiSelect',
      componentProps: {
        allowClear: true,
        api: getSimpleUserList,
        labelField: 'nickname',
        placeholder: '请选择复核人',
        valueField: 'id',
      },
    },
    {
      fieldName: 'approveUserId',
      label: '审核人',
      component: 'ApiSelect',
      componentProps: {
        allowClear: true,
        api: getSimpleUserList,
        labelField: 'nickname',
        placeholder: '请选择审核人',
        valueField: 'id',
      },
    },
    {
      fieldName: 'checkResult',
@@ -274,9 +362,13 @@
    {
      fieldName: 'vendorId',
      label: '供应商',
      component: markRaw(MdVendorSelect),
      component: 'ApiSelect',
      componentProps: {
        allowClear: true,
        api: getSupplierSimpleList,
        labelField: 'name',
        placeholder: '请选择供应商',
        valueField: 'id',
      },
    },
    {
@@ -352,16 +444,6 @@
      minWidth: 180,
    },
    {
      field: 'vendorNickname',
      title: '供应商简称',
      width: 120,
    },
    {
      field: 'vendorBatch',
      title: '供应商批次号',
      width: 130,
    },
    {
      field: 'itemCode',
      title: '产品物料编码',
      width: 130,
@@ -396,6 +478,12 @@
      },
    },
    {
      field: 'indicatorResultSummary',
      title: '检测结果(检验项)',
      minWidth: 200,
      showOverflow: 'tooltip',
    },
    {
      field: 'receiveDate',
      title: '来料日期',
      width: 120,
@@ -413,6 +501,16 @@
      width: 100,
    },
    {
      field: 'auditNickname',
      title: '复核人',
      width: 100,
    },
    {
      field: 'approveNickname',
      title: '审核人',
      width: 100,
    },
    {
      field: 'status',
      title: '单据状态',
      width: 100,
@@ -423,7 +521,7 @@
    },
    {
      title: '操作',
      width: 180,
      width: 420,
      fixed: 'right',
      slots: { default: 'actions' },
    },