gaoluyang
7 小时以前 cb9cd49627b65a4c0e137e08063271a8cefe1826
src/views/wls/salesnotice/data.ts
@@ -8,23 +8,22 @@
import {
  DICT_TYPE,
  MesAutoCodeRuleCode,
  MesWmSalesNoticeOutStatusEnum,
} from '@vben/constants';
import { Button, Tag } from 'ant-design-vue';
import { Button } from 'ant-design-vue';
import { z } from '#/adapter/form';
import { generateAutoCode } from '#/api/mes/md/autocode/record';
import CrmCustomerSelect from '#/components/crm-customer-select.vue';
import { ErpSaleOrderSelect } from '#/views/erp/sale/order/components';
import { MdClientSelect } from '#/views/mes/md/client/components';
import { MdItemSelect } from '#/views/mes/md/item/components';
/** 表单类型 */
export type FormType = 'create' | 'detail' | 'finish' | 'update';
export type FormType = 'create' | 'detail' | 'update';
/** 表单头部是否只读(详情、执行出库态) */
/** 表单头部是否只读(详情态) */
function isHeaderReadonly(formType: FormType): boolean {
  return formType === 'detail' || formType === 'finish';
  return formType === 'detail';
}
/** 新增/修改的表单 */
@@ -93,35 +92,17 @@
        onChange: (item: any) => {
          if (item?.customerId && formApi) {
            formApi.setFieldValue('clientId', item.customerId);
            formApi.setFieldValue('clientName', item.customerName);
          }
        },
      },
    },
    {
      fieldName: 'clientName',
      label: '',
      component: 'Input',
      dependencies: {
        triggerFields: [''],
        show: () => false,
      },
    },
    {
      fieldName: 'clientId',
      label: '客户',
      component: markRaw(MdClientSelect),
      component: markRaw(CrmCustomerSelect),
      componentProps: {
        placeholder: '请选择客户',
        disabled: true,
      },
      dependencies: {
        triggerFields: ['clientName'],
        componentProps: (values) => ({
          placeholder: '请选择客户',
          disabled: true,
          clientName: values.clientName as string,
        }),
      },
      rules: 'selectRequired',
    },
@@ -196,7 +177,7 @@
      },
    },
    {
      fieldName: 'salesOrderCode',
      fieldName: 'saleOrderCode',
      label: '销售订单编号',
      component: 'Input',
      componentProps: {
@@ -207,7 +188,7 @@
    {
      fieldName: 'clientId',
      label: '客户',
      component: markRaw(MdClientSelect),
      component: markRaw(CrmCustomerSelect),
      componentProps: {
        placeholder: '请选择客户',
      },
@@ -230,7 +211,7 @@
      minWidth: 150,
    },
    {
      field: 'salesOrderCode',
      field: 'saleOrderCode',
      title: '销售订单编号',
      minWidth: 140,
    },
@@ -273,20 +254,7 @@
      field: 'outStatus',
      title: '出库状态',
      minWidth: 100,
      cellRender: {
        name: 'CellTag',
        props: {
          formatter: ({ row }: { row: MesWmSalesNoticeApi.SalesNotice }) => {
            const statusMap: Record<number, { color: string; label: string }> = {
              [MesWmSalesNoticeOutStatusEnum.NONE]: { color: 'default', label: '未出库' },
              [MesWmSalesNoticeOutStatusEnum.PARTIAL]: { color: 'warning', label: '部分出库' },
              [MesWmSalesNoticeOutStatusEnum.ALL]: { color: 'success', label: '全部出库' },
            };
            const status = statusMap[row.outStatus ?? MesWmSalesNoticeOutStatusEnum.NONE];
            return { color: status?.color, label: status?.label ?? '未出库' };
          },
        },
      },
      slots: { default: 'outStatus' },
    },
    {
      title: '操作',