gaoluyang
2 天以前 787ccc59ba89bacc075562a161ecf02bc76ebadc
src/views/erp/sale/order/data.ts
@@ -1,16 +1,16 @@
import type { VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import { DICT_TYPE } from '../../../../packages/constants/src';
import { getDictOptions } from '../../../../packages/effects/hooks/src';
import { erpPriceInputFormatter } from '../../../../packages/utils/src';
import { erpPriceInputFormatter } from '@vben/utils';
import { z } from '#/adapter/form';
import { getAccountSimpleList } from '#/api/erp/finance/account';
import { getProductSimpleList } from '#/api/erp/product/product';
import { getCustomerSimpleList } from '#/api/erp/sale/customer';
import { getItemPage } from '#/api/mdm/item';
import { getSimpleUserList } from '#/api/system/user';
import { getRangePickerDefaultProps } from '#/utils';
import CrmCustomerSelect from '#/components/crm-customer-select.vue';
import { markRaw } from 'vue';
/** 表单类型 */
export type FormType = 'create' | 'detail' | 'edit';
@@ -36,6 +36,35 @@
      },
    },
    {
      fieldName: 'productionStatus',
      label: '生产状态',
      component: 'Input',
      dependencies: {
        triggerFields: ['needProduction', 'productionStatus'],
        show: (values) => {
          return formType === 'detail' && values.needProduction === 1;
        },
      },
      componentProps: {
        disabled: true,
      },
      slots: { default: 'productionStatus' },
    },
    {
      fieldName: 'productionFinishTime',
      label: '生产完成时间',
      component: 'Input',
      dependencies: {
        triggerFields: ['productionStatus'],
        show: (values) => {
          return formType === 'detail' && values.productionStatus === 1;
        },
      },
      componentProps: {
        disabled: true,
      },
    },
    {
      fieldName: 'orderTime',
      label: '订单时间',
      component: 'DatePicker',
@@ -50,14 +79,10 @@
    {
      label: '客户',
      fieldName: 'customerId',
      component: 'ApiSelect',
      component: markRaw(CrmCustomerSelect),
      componentProps: {
        placeholder: '请选择客户',
        allowClear: true,
        showSearch: true,
        api: getCustomerSimpleList,
        labelField: 'name',
        valueField: 'id',
      },
      rules: 'required',
    },
@@ -86,23 +111,13 @@
      formItemClass: 'col-span-2',
    },
    {
      fieldName: 'fileUrl',
      fieldName: 'blobIds',
      label: '附件',
      component: 'FileUpload',
      componentProps: {
        maxNumber: 1,
        maxSize: 10,
        accept: [
          'pdf',
          'doc',
          'docx',
          'xls',
          'xlsx',
          'txt',
          'jpg',
          'jpeg',
          'png',
        ],
        valueKey: 'id',
        maxNumber: 10,
        multiple: true,
        showDescription: formType !== 'detail',
        disabled: formType === 'detail',
      },
@@ -192,20 +207,36 @@
      slots: { default: 'productId' },
    },
    {
      field: 'productSpecification',
      title: '规格型号',
      minWidth: 120,
    },
    {
      field: 'stockCount',
      title: '库存',
      minWidth: 80,
      formatter: 'formatAmount3',
    },
    {
      field: 'productBarCode',
      title: '条码',
      minWidth: 120,
    },
    {
      field: 'productUnitName',
      title: '单位',
      minWidth: 80,
    },
    {
      field: 'productUnitName2',
      title: '辅单位1',
      minWidth: 80,
    },
    {
      field: 'productUnitName3',
      title: '辅单位2',
      minWidth: 80,
    },
    {
      field: 'needProduction',
      title: '需要生产',
      minWidth: 100,
      slots: { default: 'needProduction' },
    },
    {
      field: 'remark',
@@ -257,7 +288,7 @@
    },
    {
      title: '操作',
      width: 50,
      width: 80,
      fixed: 'right',
      slots: { default: 'actions' },
      visible: !disabled,
@@ -285,7 +316,10 @@
        placeholder: '请选择产品',
        allowClear: true,
        showSearch: true,
        api: getProductSimpleList,
        api: async () => {
          const res = await getItemPage({ pageNo: 1, pageSize: 100, status: 0 });
          return res.list || [];
        },
        labelField: 'name',
        valueField: 'id',
      },
@@ -302,14 +336,10 @@
    {
      fieldName: 'supplierId',
      label: '客户',
      component: 'ApiSelect',
      component: markRaw(CrmCustomerSelect),
      componentProps: {
        placeholder: '请选择客户',
        allowClear: true,
        showSearch: true,
        api: getCustomerSimpleList,
        labelField: 'name',
        valueField: 'id',
      },
    },
    {
@@ -330,7 +360,11 @@
      label: '状态',
      component: 'Select',
      componentProps: {
        options: getDictOptions(DICT_TYPE.ERP_AUDIT_STATUS, 'number'),
        options: [
          { label: '未审核', value: 10 },
          { label: '已审核', value: 20 },
          { label: '已作废', value: 30 },
        ],
        placeholder: '请选择状态',
        allowClear: true,
      },
@@ -351,24 +385,25 @@
      componentProps: {
        options: [
          { label: '未出库', value: 0 },
          { label: '部分出库', value: 1 },
          { label: '全部出库', value: 2 },
          { label: '已预留', value: 1 },
          { label: '部分出库', value: 2 },
          { label: '全部出库', value: 3 },
        ],
        placeholder: '请选择出库状态',
        allowClear: true,
      },
    },
    {
      fieldName: 'returnStatus',
      label: '退货状态',
      fieldName: 'productionStatus',
      label: '生产状态',
      component: 'Select',
      componentProps: {
        options: [
          { label: '未退货', value: 0 },
          { label: '部分退货', value: 1 },
          { label: '全部退货', value: 2 },
          { label: '无需生产', value: -1 },
          { label: '未完成', value: 0 },
          { label: '已完成', value: 1 },
        ],
        placeholder: '请选择退货状态',
        placeholder: '请选择生产状态',
        allowClear: true,
      },
    },
@@ -388,6 +423,7 @@
      title: '订单单号',
      width: 200,
      fixed: 'left',
      slots: { default: 'no' },
    },
    {
      field: 'productNames',
@@ -399,6 +435,12 @@
      field: 'customerName',
      title: '客户',
      minWidth: 120,
    },
    {
      field: 'contractNo',
      title: '关联合同',
      minWidth: 150,
      slots: { default: 'contractNo' },
    },
    {
      field: 'orderTime',
@@ -414,18 +456,6 @@
    {
      field: 'totalCount',
      title: '总数量',
      formatter: 'formatAmount3',
      minWidth: 120,
    },
    {
      field: 'outCount',
      title: '出库数量',
      formatter: 'formatAmount3',
      minWidth: 120,
    },
    {
      field: 'returnCount',
      title: '退货数量',
      formatter: 'formatAmount3',
      minWidth: 120,
    },
@@ -448,13 +478,32 @@
      minWidth: 120,
    },
    {
      field: 'outStatus',
      title: '出库状态',
      minWidth: 100,
      fixed: 'right',
      slots: { default: 'outStatus' },
    },
    {
      field: 'productionStatus',
      title: '生产状态',
      minWidth: 100,
      fixed: 'right',
      slots: { default: 'productionStatus' },
    },
    {
      field: 'status',
      title: '状态',
      minWidth: 120,
      cellRender: {
        name: 'CellDict',
        props: { type: DICT_TYPE.ERP_AUDIT_STATUS },
      },
      minWidth: 100,
      fixed: 'right',
      slots: { default: 'status' },
    },
    {
      field: 'needProduction',
      title: '需要生产',
      minWidth: 100,
      fixed: 'right',
      slots: { default: 'needProduction' },
    },
    {
      title: '操作',