diff --git a/src/components/TemplateLetter2025/Index.jsx b/src/components/TemplateLetter2025/Index.jsx index 0285b71..1a8e8fc 100644 --- a/src/components/TemplateLetter2025/Index.jsx +++ b/src/components/TemplateLetter2025/Index.jsx @@ -72,6 +72,7 @@ function buildTable(cols, data) { columnSpan: td.columnSpan, children: [new Paragraph({ text: td.title, alignment: AlignmentType.CENTER, style: 'TableHeader' })], verticalAlign: AlignmentType.CENTER, + ...(td.width ? { width: { size: 1200, type: WidthType.DXA } } : {}), }) ), }) diff --git a/src/views/HostCaseReport.jsx b/src/views/HostCaseReport.jsx index 45cb5d5..4276e76 100644 --- a/src/views/HostCaseReport.jsx +++ b/src/views/HostCaseReport.jsx @@ -9,6 +9,7 @@ import { useShallow } from 'zustand/shallow'; import { exportDoc } from '../components/TemplateLetter2025/Index'; import ExportDocxBtn from '../components/TemplateLetter2025/ExportDocxBtn'; +const sorter = (a, b, key) => parseInt(a[key]) - parseInt(b[key]); const HostCaseReport = ({ ...props }) => { const { date_picker_store } = useContext(stores_Context); // const host_case_data = customer_store.host_case_data; @@ -26,19 +27,35 @@ const HostCaseReport = ({ ...props }) => { }; const summaryCols = [ - { title: '接团数', dataIndex: 'group_count', width: '6rem' }, - { title: 'feedback团数', dataIndex: 'feedbak_group', width: '6rem' }, - { title: '东道主团数', dataIndex: 'group_count_dongdaozhu', width1: '8rem' }, - { title: '东道主个数', dataIndex: 'case_count_dongdaozhu', width1: '8rem' }, + { title: '接团数', dataIndex: 'group_count', width: '6rem', + sorter: (a, b) => sorter(a,b, 'group_count'), + }, + // { title: 'feedback团数', dataIndex: 'feedbak_group', width: '6rem' }, + { title: '东道主团数', dataIndex: 'group_count_dongdaozhu', width1: '8rem', + sorter: (a, b) => sorter(a,b, 'group_count_dongdaozhu'), + }, + { title: '东道主个数', dataIndex: 'case_count_dongdaozhu', width1: '8rem', + sorter: (a, b) => sorter(a,b, 'case_count_dongdaozhu'), + }, { title: '东道主实施比例', dataIndex: 'dongdaozhu_rate' }, { title: '各类型个数', children: [ - { title: 'Live There', dataIndex: 'live_there_count' }, - { title: '动机圆梦', dataIndex: 'dream_fulfillment_count' }, - { title: '仪式感创造', dataIndex: 'ceremony_creation_count' }, - { title: '遗憾弥补', dataIndex: 'regret_compensation_count' }, - { title: '力挽狂澜', dataIndex: 'rescue_mission_count' }, + { title: 'Live There', dataIndex: 'live_there_count', + sorter: (a, b) => sorter(a, b, 'live_there_count'), + }, + { title: '动机圆梦', dataIndex: 'dream_fulfillment_count', + sorter: (a, b) => sorter(a, b, 'dream_fulfillment_count'), + }, + { title: '仪式感创造', dataIndex: 'ceremony_creation_count', + sorter: (a, b) => sorter(a, b, 'ceremony_creation_count'), + }, + { title: '遗憾弥补', dataIndex: 'regret_compensation_count', + sorter: (a, b) => sorter(a, b, 'regret_compensation_count'), + }, + { title: '力挽狂澜', dataIndex: 'rescue_mission_count', + sorter: (a, b) => sorter(a, b, 'rescue_mission_count'), + }, ], }, ]; @@ -52,7 +69,7 @@ const HostCaseReport = ({ ...props }) => { return ( <> - +
{ ...toJS(date_picker_store.formValues), ...searchValues, }, - shows: ['dates', 'agency'], + shows: ['years', 'agency'], fieldProps: { DepartmentList: { show_all: false, mode: 'multiple' }, dates: { hide_vs: true }, + years: { hide_vs: true }, agency: { rules: [{ required: true, message: '请选择地接社' }] }, }, }} @@ -81,20 +99,20 @@ const HostCaseReport = ({ ...props }) => { subject={forExport.title} title={forExport.agencyName} sectionsData={[ - { tableTitle: '2025年东道主总体情况', tableColumns: summaryCols, tableData: caseSummary }, - { tableTitle: '2025年导游实施东道主情况', tableColumns: guideSummaryCols, tableData: caseSummaryByGuide }, - { tableTitle: '2025年精品案例', tableColumns: featuredCaseCols, tableData: caseFeatured }, + { tableTitle: forExport.year+ '年东道主总体情况', tableColumns: summaryCols, tableData: caseSummary }, + { tableTitle: forExport.year+ '年导游实施东道主情况', tableColumns: guideSummaryCols, tableData: caseSummaryByGuide }, + { tableTitle: forExport.year+ '年精品案例', tableColumns: featuredCaseCols, tableData: caseFeatured }, ]} /> - 2025年东道主总体情况 - - 2025年导游实施东道主情况 -
- 2025年精品案例 -
+ {forExport.year}年东道主总体情况 +
+ {forExport.year}年导游实施东道主情况 +
+ {forExport.year}年精品案例 +
- + ); }; diff --git a/src/zustand/HostCase.js b/src/zustand/HostCase.js index e4c247d..f975490 100644 --- a/src/zustand/HostCase.js +++ b/src/zustand/HostCase.js @@ -60,6 +60,7 @@ const initialState = { forExport: { agencyName: '', title: '', + year: '', } }; @@ -92,7 +93,11 @@ const useHostCaseStore = create( caseSummary: summary, caseSummaryByGuide: guideSummary, caseFeatured: featured, - forExport: { title: `${moment(params.Date1).format('YYYY年MM月')}-${moment(params.Date2).format('YYYY年MM月')}总结`, agencyName: searchValues.agency.label }, + forExport: { + title: `${moment(params.Date1).format('YYYY年')}总结`, + agencyName: searchValues.agency.label, + year: moment(params.Date1).format('YYYY'), + }, }); setLoading(false); },