云
2026-09-22 f063fdb79367d4c51a6da1541ff55833d2c49a38
src/views/mes/qc/oqc/data.ts
@@ -5,15 +5,17 @@
import { h, markRaw } from 'vue';
import { DICT_TYPE, MesAutoCodeRuleCode } from '..\..\..\..\packages\constants\src';
import { getDictOptions } from '..\..\..\..\packages\effects\hooks\src';
import { DICT_TYPE, MesAutoCodeRuleCode } from '@vben/constants';
import { getDictOptions } from '@vben/hooks';
import { Button } from 'ant-design-vue';
import { generateAutoCode } from '#/api/mes/md/autocode/record';
import { getTemplateItemOptionList } from '#/api/mes/qc/template/item';
import { getSimpleUserList } from '#/api/system/user';
import { MdClientSelect } from '#/views/mes/md/client/components';
import { MdItemSelect } from '#/views/mes/md/item/components';
import { getRangePickerDefaultProps } from '#/utils';
import CrmCustomerSelect from '#/components/crm-customer-select.vue';
import { MdmItemSelect } from '#/views/basicData/mdm/components';
/** 表单类型 */
export type FormType = 'create' | 'detail' | 'update';
@@ -119,7 +121,7 @@
    {
      fieldName: 'itemId',
      label: '产品物料',
      component: markRaw(MdItemSelect),
      component: markRaw(MdmItemSelect),
      componentProps: {
        placeholder: '请选择产品物料',
      },
@@ -133,13 +135,39 @@
      },
    },
    {
      fieldName: 'templateId',
      label: '质检方案',
      component: 'ApiSelect',
      componentProps: {
        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: 3 }
            : {},
          placeholder: values.itemId ? '请选择质检方案' : '请先选择产品物料',
        }),
      },
    },
    {
      fieldName: 'clientId',
      label: '客户',
      component: markRaw(MdClientSelect),
      component: markRaw(CrmCustomerSelect),
      componentProps: {
        placeholder: '请选择客户',
      },
      rules: 'selectRequired',
      dependencies: {
        triggerFields: ['sourceDocId'],
        componentProps: (values) => ({
@@ -174,7 +202,6 @@
          }
        },
      },
      rules: 'required',
      dependencies: {
        triggerFields: ['sourceDocId'],
        componentProps: (values) => ({
@@ -210,7 +237,6 @@
          }
        },
      },
      rules: 'required',
    },
    {
      fieldName: 'qualifiedQuantity',
@@ -233,6 +259,7 @@
        placeholder: '请输入不合格品数量',
      },
      rules: 'required',
      help: '不合格品数量大于0时,保存后将自动生成不合格处理单',
    },
    {
      fieldName: 'inspectorUserId',
@@ -254,9 +281,8 @@
      componentProps: {
        format: 'YYYY-MM-DD',
        placeholder: '请选择出货日期',
        valueFormat: 'x',
        valueFormat: 'YYYY-MM-DD',
      },
      rules: 'required',
    },
    {
      fieldName: 'inspectDate',
@@ -265,7 +291,7 @@
      componentProps: {
        format: 'YYYY-MM-DD',
        placeholder: '请选择检测日期',
        valueFormat: 'x',
        valueFormat: 'YYYY-MM-DD',
      },
      rules: 'required',
    },
@@ -307,7 +333,7 @@
    {
      fieldName: 'clientId',
      label: '客户',
      component: markRaw(MdClientSelect),
      component: markRaw(CrmCustomerSelect),
      componentProps: {
        placeholder: '请选择客户',
      },
@@ -324,7 +350,7 @@
    {
      fieldName: 'itemId',
      label: '产品物料',
      component: markRaw(MdItemSelect),
      component: markRaw(MdmItemSelect),
      componentProps: {
        placeholder: '请选择产品物料',
      },
@@ -337,6 +363,14 @@
        allowClear: true,
        options: getDictOptions(DICT_TYPE.MES_QC_CHECK_RESULT, 'number'),
        placeholder: '请选择检测结果',
      },
    },
    {
      fieldName: 'inspectDate',
      label: '检测日期',
      component: 'RangePicker',
      componentProps: {
        ...getRangePickerDefaultProps(),
      },
    },
  ];
@@ -355,16 +389,6 @@
      field: 'name',
      title: '检验单名称',
      minWidth: 180,
    },
    {
      field: 'clientNickname',
      title: '客户名称',
      width: 120,
    },
    {
      field: 'batchCode',
      title: '批次号',
      width: 130,
    },
    {
      field: 'itemCode',
@@ -387,16 +411,6 @@
      width: 80,
    },
    {
      field: 'outQuantity',
      title: '发货数量',
      width: 100,
    },
    {
      field: 'checkQuantity',
      title: '检测数量',
      width: 100,
    },
    {
      field: 'unqualifiedQuantity',
      title: '不合格数',
      width: 100,
@@ -409,12 +423,6 @@
        name: 'CellDict',
        props: { type: DICT_TYPE.MES_QC_CHECK_RESULT },
      },
    },
    {
      field: 'outDate',
      title: '出货日期',
      width: 120,
      formatter: 'formatDate',
    },
    {
      field: 'inspectDate',