Просмотр исходного кода

Merge branch 'dev' of http://192.168.1.41:3000/outaozhen/cldV2react into dev

outaozhen 4 лет назад
Родитель
Сommit
af153e5dce

+ 2 - 2
src/components/Table/src/hooks/useTableScroll.ts

@@ -76,8 +76,8 @@ export function useTableScroll({
 
 
     if (!dataSource?.length) {
     if (!dataSource?.length) {
       // TODO:针对无数据的情况下,特别设置tboody
       // TODO:针对无数据的情况下,特别设置tboody
-      tableContainerEl!.style.marginBottom = '16px'
-      tableContainerEl!.style.paddingBottom = '16px'
+      tableContainerEl!.style.marginBottom = '32px'
+      // tableContainerEl!.style.paddingBottom = '16px'
       const tbodyEl: HTMLElement = tableContainerEl?.querySelector('tbody.ant-table-tbody')
       const tbodyEl: HTMLElement = tableContainerEl?.querySelector('tbody.ant-table-tbody')
       const el = tableContainerEl?.querySelector('table')
       const el = tableContainerEl?.querySelector('table')
       let hasScrollBar = el?.style.width !== '100%'
       let hasScrollBar = el?.style.width !== '100%'

+ 1 - 0
src/enums/index.ts

@@ -0,0 +1 @@
+export * from './invoice'

+ 14 - 0
src/enums/invoice.ts

@@ -0,0 +1,14 @@
+export enum PriceType {
+  /** @name 发票 */
+  INVOICE = 'invoice',
+  /** @name 收款 */
+  RECEIVABLES = 'receivables',
+  /** @name 入账 */
+  CREDIT = 'credit'
+}
+
+export const priceMapToName = {
+  [PriceType.INVOICE]: '发票',
+  [PriceType.RECEIVABLES]: '收款',
+  [PriceType.CREDIT]: '入账'
+}

+ 9 - 6
src/pages/Statistic/Product/InvoiceTrends/index.tsx

@@ -1,5 +1,6 @@
 import BasicTable from '@/components/Table'
 import BasicTable from '@/components/Table'
 import consts from '@/consts'
 import consts from '@/consts'
+import { priceMapToName, PriceType } from '@/enums'
 import { querySoftInvoiceTrendsList } from '@/services/statistic'
 import { querySoftInvoiceTrendsList } from '@/services/statistic'
 import { disabledDate } from '@/utils/utils'
 import { disabledDate } from '@/utils/utils'
 import { DualAxes } from '@ant-design/charts'
 import { DualAxes } from '@ant-design/charts'
@@ -14,7 +15,7 @@ const InvoiceTrends = () => {
     params: {
     params: {
       optionType: 'singleStaff',
       optionType: 'singleStaff',
       dataIds: [],
       dataIds: [],
-      priceType: 'invoice',
+      priceType: PriceType.INVOICE,
       startMonth: dayjs(new Date())
       startMonth: dayjs(new Date())
     },
     },
     chart: []
     chart: []
@@ -128,7 +129,7 @@ const InvoiceTrends = () => {
     appendPadding: [0, 24, 12, 24],
     appendPadding: [0, 24, 12, 24],
     meta: {
     meta: {
       price: {
       price: {
-        alias: '当月开票金额(元)'
+        alias: `当月${priceMapToName[state.params.priceType]}金额(元)`
       },
       },
       ring: {
       ring: {
         alias: '环比增长(%)',
         alias: '环比增长(%)',
@@ -155,7 +156,9 @@ const InvoiceTrends = () => {
       position: 'top',
       position: 'top',
       itemName: {
       itemName: {
         formatter: (_, item) => {
         formatter: (_, item) => {
-          return item.value === 'price' ? '当月开票金额(元)' : '环比增长(%)'
+          return item.value === 'price'
+            ? `当月${priceMapToName[state.params.priceType]}金额(元)`
+            : '环比增长(%)'
         }
         }
       }
       }
     },
     },
@@ -204,9 +207,9 @@ const InvoiceTrends = () => {
                 <Select
                 <Select
                   defaultValue="invoice"
                   defaultValue="invoice"
                   options={[
                   options={[
-                    { label: '发票', value: 'invoice' },
-                    { label: '收款', value: 'receivables' },
-                    { label: '入账', value: 'credit' }
+                    { label: '发票', value: PriceType.INVOICE },
+                    { label: '收款', value: PriceType.RECEIVABLES },
+                    { label: '入账', value: PriceType.CREDIT }
                   ]}
                   ]}
                   placeholder="请选择发票类型"
                   placeholder="请选择发票类型"
                   onChange={e => setState({ ...state, params: { ...state.params, priceType: e } })}
                   onChange={e => setState({ ...state, params: { ...state.params, priceType: e } })}