5 天以前 91c82965b2d987452ca276e3a03b48c8dcda2ae9
src/views/crm/product/components/data.ts
@@ -1,31 +1,29 @@
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import { DICT_TYPE } from '../../../../packages/constants/src';
/** 产品详情列表的列定义 */
export function useDetailListColumns(
  showBusinessPrice: boolean,
): VxeTableGridOptions['columns'] {
  return [
    {
      field: 'productName',
      field: 'itemName',
      title: '产品名称',
    },
    {
      field: 'productNo',
      title: '产品条码',
      field: 'itemCode',
      title: '物料编码',
    },
    {
      field: 'productUnit',
      title: '产品单位',
      cellRender: {
        name: 'CellDict',
        props: { type: DICT_TYPE.CRM_PRODUCT_UNIT },
      },
      field: 'barCode',
      title: '物料条码',
    },
    {
      field: 'productPrice',
      title: '产品价格(元)',
      field: 'itemUnitName',
      title: '单位',
    },
    {
      field: 'itemPrice',
      title: '原价(元)',
      formatter: 'formatAmount2',
    },
    {
@@ -54,41 +52,57 @@
}
/** 产品编辑表格的列定义 */
export function useProductEditTableColumns(): VxeTableGridOptions['columns'] {
export function useProductEditTableColumns(
  showBusinessPrice: boolean = false,
): VxeTableGridOptions['columns'] {
  const priceColumn = showBusinessPrice
    ? {
        field: 'businessPrice',
        title: '商机价格(元)',
        minWidth: 100,
        slots: { default: 'businessPrice' },
      }
    : {
        field: 'contractPrice',
        title: '合同价(元)',
        minWidth: 100,
        slots: { default: 'contractPrice' },
      };
  return [
    { type: 'seq', title: '序号', minWidth: 50 },
    {
      field: 'productId',
      field: 'itemId',
      title: '产品名称',
      minWidth: 100,
      slots: { default: 'productId' },
      slots: { default: 'itemId' },
    },
    {
      field: 'productNo',
      title: '条码',
      minWidth: 150,
      field: 'itemSpecification',
      title: '规格型号',
      minWidth: 120,
    },
    {
      field: 'productUnit',
      field: 'itemUnitName',
      title: '单位',
      minWidth: 100,
      cellRender: {
        name: 'CellDict',
        props: { type: DICT_TYPE.CRM_PRODUCT_UNIT },
      },
      minWidth: 80,
    },
    {
      field: 'productPrice',
      title: '价格(元)',
      field: 'itemUnitName2',
      title: '辅单位1',
      minWidth: 80,
    },
    {
      field: 'itemUnitName3',
      title: '辅单位2',
      minWidth: 80,
    },
    {
      field: 'itemPrice',
      title: '原价(元)',
      minWidth: 100,
      formatter: 'formatAmount2',
    },
    {
      field: 'sellingPrice',
      title: '售价(元)',
      minWidth: 100,
      slots: { default: 'sellingPrice' },
    },
    priceColumn,
    {
      field: 'count',
      title: '数量',