|
@@ -1,9 +1,17 @@
|
|
|
-import React, { useState } from 'react';
|
|
|
+import React, { useState, useEffect } from 'react';
|
|
|
import { Row, Col, Button, Drawer, Grid } from 'antd';
|
|
|
import { SettingOutlined } from '@ant-design/icons';
|
|
|
import { FormattedMessage } from 'react-intl';
|
|
|
+import { useSelector, useDispatch } from 'react-redux';
|
|
|
+import {
|
|
|
+ fetchWorkThunk,
|
|
|
+ workSelectionSlice,
|
|
|
+} from '../../states/patient/worklist/slices/workSlice';
|
|
|
import WorklistTable from './components/WorklistTable';
|
|
|
import OperationPanel from './components/OperationPanel';
|
|
|
+import { RootState, AppDispatch } from '../../states/store';
|
|
|
+import { Task } from '@/domain/work';
|
|
|
+import worklistToExam from '../../domain/patient/worklistToExam';
|
|
|
|
|
|
const { useBreakpoint } = Grid;
|
|
|
|
|
@@ -11,11 +19,60 @@ const HistorylistPage: React.FC = () => {
|
|
|
const screens = useBreakpoint();
|
|
|
const [drawerVisible, setDrawerVisible] = useState(false);
|
|
|
|
|
|
+ const dispatch: AppDispatch = useDispatch();
|
|
|
+ const filters = useSelector((state: RootState) => state.workFilters);
|
|
|
+ const page = useSelector((state: RootState) => state.workPagination.page);
|
|
|
+ const pageSize = useSelector(
|
|
|
+ (state: RootState) => state.workPagination.pageSize
|
|
|
+ );
|
|
|
+ const selectedIds = useSelector(
|
|
|
+ (state: RootState) => state.workSelection.selectedIds
|
|
|
+ );
|
|
|
+ const worklistData = useSelector(
|
|
|
+ (state: RootState) => state.workEntities.data
|
|
|
+ );
|
|
|
+
|
|
|
+ useEffect(() => {
|
|
|
+ console.log(
|
|
|
+ 'Fetching worklist data with filters:',
|
|
|
+ filters,
|
|
|
+ 'page:',
|
|
|
+ page,
|
|
|
+ 'pageSize:',
|
|
|
+ pageSize
|
|
|
+ );
|
|
|
+ dispatch(fetchWorkThunk({ page, pageSize, filters }));
|
|
|
+ }, [dispatch, filters, page, pageSize]);
|
|
|
+
|
|
|
+ const handleRowClick = (record: Task) => {
|
|
|
+ console.log('Row clicked:', JSON.stringify(record, null, 2));
|
|
|
+ console.log('Selected IDs before:', record.StudyInstanceUID);
|
|
|
+ dispatch(
|
|
|
+ workSelectionSlice.actions.setSelectedIds([record.StudyInstanceUID])
|
|
|
+ );
|
|
|
+ };
|
|
|
+
|
|
|
+ const handleRowDoubleClick = (record: Task) => {
|
|
|
+ console.log(
|
|
|
+ '[WorklistTable] Row double-clicked:',
|
|
|
+ JSON.stringify(record, null, 2)
|
|
|
+ );
|
|
|
+ worklistToExam(record);
|
|
|
+ };
|
|
|
+
|
|
|
return (
|
|
|
<div className="h-full">
|
|
|
{screens.xs ? (
|
|
|
<>
|
|
|
- <WorklistTable />
|
|
|
+ <WorklistTable
|
|
|
+ worklistData={worklistData}
|
|
|
+ filters={filters}
|
|
|
+ page={page}
|
|
|
+ pageSize={pageSize}
|
|
|
+ selectedIds={selectedIds}
|
|
|
+ handleRowClick={handleRowClick}
|
|
|
+ handleRowDoubleClick={handleRowDoubleClick}
|
|
|
+ />
|
|
|
<Button
|
|
|
type="primary"
|
|
|
shape="circle"
|
|
@@ -44,7 +101,15 @@ const HistorylistPage: React.FC = () => {
|
|
|
span={screens.lg ? 18 : screens.md ? 20 : 24}
|
|
|
className="overflow-auto"
|
|
|
>
|
|
|
- <WorklistTable />
|
|
|
+ <WorklistTable
|
|
|
+ worklistData={worklistData}
|
|
|
+ filters={filters}
|
|
|
+ page={page}
|
|
|
+ pageSize={pageSize}
|
|
|
+ selectedIds={selectedIds}
|
|
|
+ handleRowClick={handleRowClick}
|
|
|
+ handleRowDoubleClick={handleRowDoubleClick}
|
|
|
+ />
|
|
|
</Col>
|
|
|
<Col
|
|
|
span={screens.lg ? 6 : screens.md ? 4 : 0}
|