fix: upload and refresh patient list
This commit is contained in:
parent
039325b768
commit
c52b3f1e00
|
@ -8,11 +8,12 @@ export const registerDicomHandler = () => {
|
|||
const dia = await dialog.showOpenDialog({ properties: ["openDirectory"] });
|
||||
if (dia.canceled) return null;
|
||||
const dcmPaths = await filterDicoms(dia.filePaths[0]);
|
||||
uploadFilesInBatches({
|
||||
await uploadFilesInBatches({
|
||||
filePaths: dcmPaths,
|
||||
batchSize: 6,
|
||||
feedback: (d) => event.reply("dicom:upload:detail", d),
|
||||
});
|
||||
event.reply("dicom:upload:finished"); // 重新刷新病人列表
|
||||
});
|
||||
|
||||
ipcMain.handle("dicom:select", async () => {
|
||||
|
|
|
@ -23,7 +23,7 @@ export const Datasource = () => {
|
|||
const [selectedStudyId, setSelectedStudyId] = useState<string | null>(null);
|
||||
const navigate = useNavigate();
|
||||
|
||||
useEffect(() => {
|
||||
const fetchPatients = () => {
|
||||
window.ipcRenderer
|
||||
.invoke("dicom:select")
|
||||
.then((patients: PatientInfo[]) => {
|
||||
|
@ -31,6 +31,17 @@ export const Datasource = () => {
|
|||
rawPatientsRef.current = patients;
|
||||
setPatients(patients);
|
||||
});
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
fetchPatients();
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
window.ipcRenderer.on("dicom:upload:finished", fetchPatients);
|
||||
return () => {
|
||||
window.ipcRenderer.off("dicom:upload:finished", fetchPatients);
|
||||
};
|
||||
}, []);
|
||||
|
||||
const handlePatientSearch = (filterValue: string) => {
|
||||
|
|
Loading…
Reference in New Issue
Block a user