gaoluyang
14 小时以前 cb9cd49627b65a4c0e137e08063271a8cefe1826
src/views/wls/salesnotice/data.ts
@@ -5,21 +5,25 @@
import { h, markRaw } from 'vue';
import { DICT_TYPE, MesAutoCodeRuleCode } from '@vben/constants';
import {
  DICT_TYPE,
  MesAutoCodeRuleCode,
} from '@vben/constants';
import { Button } from 'ant-design-vue';
import { z } from '#/adapter/form';
import { generateAutoCode } from '#/api/mes/md/autocode/record';
import { MdClientSelect } from '#/views/mes/md/client/components';
import CrmCustomerSelect from '#/components/crm-customer-select.vue';
import { ErpSaleOrderSelect } from '#/views/erp/sale/order/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';
}
/** 新增/修改的表单 */
@@ -79,19 +83,26 @@
      rules: 'required',
    },
    {
      fieldName: 'salesOrderCode',
      label: '销售订单编号',
      component: 'Input',
      fieldName: 'saleOrderId',
      label: '销售订单',
      component: markRaw(ErpSaleOrderSelect),
      componentProps: {
        placeholder: '请输入销售订单编号',
        placeholder: '请选择销售订单',
        // 选择销售订单后,自动回填客户信息
        onChange: (item: any) => {
          if (item?.customerId && formApi) {
            formApi.setFieldValue('clientId', item.customerId);
          }
        },
      },
    },
    {
      fieldName: 'clientId',
      label: '客户',
      component: markRaw(MdClientSelect),
      component: markRaw(CrmCustomerSelect),
      componentProps: {
        placeholder: '请选择客户',
        disabled: true,
      },
      rules: 'selectRequired',
    },
@@ -166,7 +177,7 @@
      },
    },
    {
      fieldName: 'salesOrderCode',
      fieldName: 'saleOrderCode',
      label: '销售订单编号',
      component: 'Input',
      componentProps: {
@@ -177,7 +188,7 @@
    {
      fieldName: 'clientId',
      label: '客户',
      component: markRaw(MdClientSelect),
      component: markRaw(CrmCustomerSelect),
      componentProps: {
        placeholder: '请选择客户',
      },
@@ -200,7 +211,7 @@
      minWidth: 150,
    },
    {
      field: 'salesOrderCode',
      field: 'saleOrderCode',
      title: '销售订单编号',
      minWidth: 140,
    },
@@ -240,6 +251,12 @@
      },
    },
    {
      field: 'outStatus',
      title: '出库状态',
      minWidth: 100,
      slots: { default: 'outStatus' },
    },
    {
      title: '操作',
      width: 200,
      fixed: 'right',
@@ -279,6 +296,28 @@
      width: 100,
    },
    {
      field: 'outCount',
      title: '已出库数量',
      width: 100,
      formatter: ({ cellValue }: { cellValue: number }) => (cellValue || 0).toFixed(2),
    },
    {
      field: 'outProgress',
      title: '出库进度',
      width: 120,
      cellRender: {
        name: 'CellText',
        props: {
          formatter: ({ row }: { row: MesWmSalesNoticeLineApi.SalesNoticeLine }) => {
            const quantity = row.quantity || 0;
            const outCount = row.outCount || 0;
            const percent = quantity > 0 ? Math.round((outCount / quantity) * 100) : 0;
            return `${outCount.toFixed(2)} / ${quantity.toFixed(2)} (${percent}%)`;
          },
        },
      },
    },
    {
      field: 'batchCode',
      title: '批次号',
      minWidth: 120,