xiaoyi
6 天以前 a4025834e2304dc57f6e98d58feeb9416bd90609
src/views/crm/saleQuotation/data.ts
@@ -1,15 +1,20 @@
import type { VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import { DICT_TYPE } from '@vben/constants';
import { getDictOptions } from '@vben/hooks';
import { erpPriceMultiply } from '#/packages/utils/src';
import { z } from '#/adapter/form';
import { getSimpleBusinessList } from '#/api/crm/business';
import { getSimpleContactList } from '#/api/crm/contact';
import { getCustomerSimpleList } from '#/api/crm/customer';
import { getItemPage } from '#/api/mdm/item';
import { getSimpleUserList } from '#/api/system/user';
import { useUserStore } from '#/packages/stores/src';
import CrmCustomerSelect from '#/components/crm-customer-select.vue';
import { markRaw } from 'vue';
/** 报价单状态 */
export const QUOTATION_STATUS = {
@@ -62,12 +67,9 @@
    {
      fieldName: 'customerId',
      label: '客户名称',
      component: 'ApiSelect',
      component: markRaw(CrmCustomerSelect),
      rules: 'required',
      componentProps: {
        api: getCustomerSimpleList,
        labelField: 'name',
        valueField: 'id',
        placeholder: '请选择客户',
      },
    },
@@ -125,10 +127,11 @@
      fieldName: 'quotationTime',
      label: '报价日期',
      component: 'DatePicker',
      rules: 'required',
      componentProps: {
        showTime: false,
        format: 'YYYY-MM-DD',
        valueFormat: 'x',
        valueFormat: 'YYYY-MM-DD',
        placeholder: '请选择报价日期',
      },
    },
@@ -139,7 +142,7 @@
      componentProps: {
        showTime: false,
        format: 'YYYY-MM-DD',
        valueFormat: 'x',
        valueFormat: 'YYYY-MM-DD',
        placeholder: '请选择有效期',
      },
    },
@@ -156,6 +159,81 @@
      },
    },
    {
      fieldName: 'quotationType',
      label: '报价类型',
      component: 'Select',
      componentProps: {
        options: getDictOptions(DICT_TYPE.CRM_QUOTATION_TYPE),
        placeholder: '请选择报价类型',
        allowClear: true,
      },
    },
    {
      fieldName: 'capacity',
      label: '合同容量(kVA)',
      component: 'InputNumber',
      componentProps: {
        class: '!w-full',
        min: 0,
        precision: 2,
        placeholder: '请输入合同容量',
      },
    },
    {
      fieldName: 'maxDemand',
      label: '最大需量(kW)',
      component: 'InputNumber',
      componentProps: {
        class: '!w-full',
        min: 0,
        precision: 2,
        placeholder: '请输入最大需量',
      },
    },
    {
      fieldName: 'unitPrice',
      label: '电度单价(元/kWh)',
      component: 'InputNumber',
      componentProps: {
        class: '!w-full',
        min: 0,
        precision: 4,
        placeholder: '请输入电度单价',
      },
    },
    {
      fieldName: 'tariffMode',
      label: '电价模式',
      component: 'Select',
      componentProps: {
        options: getDictOptions(DICT_TYPE.CRM_TARIFF_MODE),
        placeholder: '请选择电价模式',
        allowClear: true,
      },
    },
    {
      fieldName: 'powerFactorFee',
      label: '力调电费(元)',
      component: 'InputNumber',
      componentProps: {
        class: '!w-full',
        min: 0,
        precision: 2,
        placeholder: '请输入力调电费',
      },
    },
    {
      fieldName: 'billingCycle',
      label: '结算周期(月)',
      component: 'InputNumber',
      componentProps: {
        class: '!w-full',
        min: 1,
        precision: 0,
        placeholder: '请输入结算周期',
      },
    },
    {
      fieldName: 'remark',
      label: '备注',
      component: 'Textarea',
@@ -166,7 +244,7 @@
    },
    {
      fieldName: 'items',
      label: '物料清单',
      label: '产品清单',
      component: 'Input',
      formItemClass: 'col-span-3',
    },
@@ -240,11 +318,8 @@
    {
      fieldName: 'customerId',
      label: '客户',
      component: 'ApiSelect',
      component: markRaw(CrmCustomerSelect),
      componentProps: {
        api: getCustomerSimpleList,
        labelField: 'name',
        valueField: 'id',
        placeholder: '请选择客户',
        allowClear: true,
      },
@@ -284,6 +359,15 @@
      title: '报价单名称',
      minWidth: 160,
      fixed: 'left',
    },
    {
      field: 'quotationType',
      title: '报价类型',
      minWidth: 100,
      cellRender: {
        name: 'CellDict',
        props: { type: DICT_TYPE.CRM_QUOTATION_TYPE },
      },
    },
    {
      field: 'customerName',
@@ -344,24 +428,19 @@
  ];
}
/** 物料明细表格列 */
/** 产品明细表格列 */
export function useItemColumns(): VxeTableGridOptions['columns'] {
  return [
    { type: 'seq', title: '序号', minWidth: 50, fixed: 'left' },
    {
      field: 'itemId',
      title: '物料名称',
      title: '产品名称',
      minWidth: 200,
      slots: { default: 'itemId' },
    },
    {
      field: 'itemSpecification',
      title: '规格型号',
      minWidth: 120,
    },
    {
      field: 'itemBarCode',
      title: '条码',
      minWidth: 120,
    },
    {