src/views/erp/purchase/order/data.ts
@@ -9,10 +9,10 @@
import { z } from '#/adapter/form';
import { getAccountSimpleList } from '#/api/erp/finance/account';
import { getSupplierSimpleList } from '#/api/erp/purchase/supplier';
import { getSupplierSimpleList } from '#/api/srm/supplier';
import { getSimpleUserList } from '#/api/system/user';
import { MdmItemSelect } from '#/views/basicData/mdm/components';
import { getRangePickerDefaultProps } from '#/utils';
import { getRangePickerDefaultProps, withoutFixedColumns } from '#/utils';
/** 表单类型 */
export type FormType = 'create' | 'detail' | 'edit';
@@ -45,7 +45,7 @@
        placeholder: '选择订单时间',
        showTime: true,
        format: 'YYYY-MM-DD HH:mm:ss',
        valueFormat: 'x',
        valueFormat: 'YYYY-MM-DD HH:mm:ss',
      },
      rules: 'required',
    },
@@ -65,14 +65,27 @@
    },
    {
      component: 'InputNumber',
      componentProps: {
      componentProps: (values) => ({
        class: '!w-full',
        placeholder: '请输入支付订金',
        precision: 2,
        min: 0,
      },
        max: values.totalPrice ?? undefined,
      }),
      fieldName: 'depositPrice',
      label: '支付订金',
      dependencies: {
        triggerFields: ['totalPrice'],
        rules(values) {
          if (values.totalPrice != null) {
            return z
              .number()
              .min(0, '订金不能小于0')
              .max(values.totalPrice, '订金不能大于优惠后含税金额');
          }
          return z.number().min(0, '订金不能小于0');
        },
      },
      rules: 'required',
    },
    {
@@ -132,11 +145,11 @@
    },
    {
      fieldName: 'totalPrice',
      label: '优惠后金额',
      label: '优惠后含税金额',
      component: 'InputNumber',
      componentProps: {
        class: '!w-full',
        placeholder: '优惠后金额',
        placeholder: '优惠后含税金额',
        precision: 2,
        formatter: erpPriceInputFormatter,
        disabled: true,
@@ -162,7 +175,7 @@
export function useFormItemColumns(
  disabled: boolean,
): VxeTableGridOptions['columns'] {
  return [
  const columns: VxeTableGridOptions['columns'] = [
    { type: 'seq', title: '序号', minWidth: 50, fixed: 'left' },
    {
      field: 'productId',
@@ -197,17 +210,10 @@
    },
    {
      field: 'productPrice',
      title: '产品单价',
      title: '含税单价(元)',
      minWidth: 120,
      fixed: 'right',
      slots: { default: 'productPrice' },
    },
    {
      field: 'totalProductPrice',
      title: '金额',
      minWidth: 120,
      fixed: 'right',
      formatter: 'formatAmount2',
    },
    {
      field: 'taxPercent',
@@ -217,15 +223,22 @@
      slots: { default: 'taxPercent' },
    },
    {
      field: 'totalProductPrice',
      title: '不含税金额(元)',
      minWidth: 120,
      fixed: 'right',
      formatter: 'formatAmount2',
    },
    {
      field: 'taxPrice',
      title: '税额',
      title: '税额(元)',
      minWidth: 120,
      fixed: 'right',
      formatter: 'formatAmount2',
    },
    {
      field: 'totalPrice',
      title: '税额合计',
      title: '含税合计(元)',
      minWidth: 120,
      fixed: 'right',
      formatter: 'formatAmount2',
@@ -238,6 +251,8 @@
      visible: !disabled,
    },
  ];
  // 查看审批明细(只读)时取消固定列,避免窄弹窗里挤掉产品名称、单位、备注等列
  return disabled ? withoutFixedColumns(columns) : columns;
}
/** 列表的搜索表单 */
@@ -389,7 +404,7 @@
    },
    {
      field: 'totalProductPrice',
      title: '金额合计',
      title: '不含税金额合计',
      formatter: 'formatAmount2',
      minWidth: 120,
    },