gaoluyang
11 小时以前 9d7b3deff138a1c10ccf9b112e71fad8c0a8a004
fix(crm): 合同产品数量保留一位小数

- 新增 formatAmount1 格式化器(1 位小数)
- 合同产品详情/审批列表的数量列改为 1 位小数,商机保持 3 位
- 合同产品编辑表格数量输入精度改为 1 位、最小值 0.1,商机行为不变

Co-Authored-By: Claude Code <noreply@anthropic.com>
已修改4个文件
17 ■■■■■ 文件已修改
src/adapter/vxe-table.ts 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/crm/contract/detail/approve/index.vue 4 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/crm/product/components/data.ts 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/crm/product/components/edit-table.vue 4 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/adapter/vxe-table.ts
@@ -373,6 +373,12 @@
        return erpCountInputFormatter(cellValue);
      },
    });
    // 合同产品数量:保留 1 位小数
    vxeUI.formats.add('formatAmount1', {
      tableCellFormatMethod({ cellValue }) {
        return `${erpNumberFormatter(cellValue, 1)}`;
      },
    });
    // add by 星语:数量格式化,保留 2 位
    vxeUI.formats.add('formatAmount2', {
      tableCellFormatMethod({ cellValue }, digits = 2) {
src/views/crm/contract/detail/approve/index.vue
@@ -8,7 +8,7 @@
import { ContentWrap } from '@vben/common-ui';
import { DICT_TYPE } from '@vben/constants';
import {
  erpCountInputFormatter,
  erpNumberFormatter,
  erpPriceInputFormatter,
  formatDateTime,
} from '@vben/utils';
@@ -49,7 +49,7 @@
      field: 'count',
      title: '数量',
      minWidth: 100,
      formatter: ({ cellValue }) => erpCountInputFormatter(cellValue) || '-',
      formatter: ({ cellValue }) => erpNumberFormatter(cellValue, 1) || '-',
    },
    {
      field: 'totalPrice',
src/views/crm/product/components/data.ts
@@ -41,7 +41,8 @@
    {
      field: 'count',
      title: '数量',
      formatter: 'formatAmount3',
      // 商机保留 3 位;合同数量保留 1 位(见 adapter 的 formatAmount1)
      formatter: showBusinessPrice ? 'formatAmount3' : 'formatAmount1',
    },
    {
      field: 'totalPrice',
src/views/crm/product/components/edit-table.vue
@@ -155,8 +155,8 @@
    <template #count="{ row }">
      <InputNumber
        v-model:value="row.count"
        :min="0.001"
        :precision="3"
        :min="isBusiness ? 0.001 : 0.1"
        :precision="isBusiness ? 3 : 1"
        @change="handlePriceChange(row)"
      />
    </template>