diff --git a/apps/web/src/pages/health/AiAnalysisList.tsx b/apps/web/src/pages/health/AiAnalysisList.tsx index 964c844..ce4a9bd 100644 --- a/apps/web/src/pages/health/AiAnalysisList.tsx +++ b/apps/web/src/pages/health/AiAnalysisList.tsx @@ -1,4 +1,4 @@ -import { useEffect, useState, useCallback } from 'react'; +import { useEffect, useState, useCallback, useMemo } from 'react'; import { Table, Select, Tag, Space, message, Typography } from 'antd'; import { useThemeMode } from '../../hooks/useThemeMode'; import { analysisApi, type AnalysisItem } from '../../api/ai/analysis'; @@ -69,7 +69,7 @@ export default function AiAnalysisList() { } }; - const columns = [ + const columns = useMemo(() => [ { title: '分析类型', dataIndex: 'analysis_type', @@ -112,7 +112,7 @@ export default function AiAnalysisList() { width: 170, render: (v: string) => (v ? new Date(v).toLocaleString('zh-CN') : '-'), }, - ]; + ], []); return (
diff --git a/apps/web/src/pages/health/AiPromptList.tsx b/apps/web/src/pages/health/AiPromptList.tsx index b5dba72..56097eb 100644 --- a/apps/web/src/pages/health/AiPromptList.tsx +++ b/apps/web/src/pages/health/AiPromptList.tsx @@ -1,4 +1,4 @@ -import { useEffect, useState, useCallback } from 'react'; +import { useEffect, useState, useCallback, useMemo } from 'react'; import { Table, Button, @@ -92,7 +92,7 @@ export default function AiPromptList() { } }; - const columns = [ + const columns = useMemo(() => [ { title: '名称', dataIndex: 'name', @@ -161,7 +161,7 @@ export default function AiPromptList() { ), }, - ]; + ], [handleActivate, handleRollback]); return (
diff --git a/apps/web/src/pages/health/AppointmentList.tsx b/apps/web/src/pages/health/AppointmentList.tsx index ddfcce9..36fcb14 100644 --- a/apps/web/src/pages/health/AppointmentList.tsx +++ b/apps/web/src/pages/health/AppointmentList.tsx @@ -1,4 +1,4 @@ -import { useState, useCallback, useEffect } from 'react'; +import { useState, useCallback, useEffect, useMemo } from 'react'; import { Table, Button, @@ -269,7 +269,7 @@ export default function AppointmentList() { }; // ---- 列定义 ---- - const columns = [ + const columns = useMemo(() => [ { title: '患者', dataIndex: 'patient_name', @@ -362,7 +362,7 @@ export default function AppointmentList() { ); }, }, - ]; + ], [handleStatusChange]); return ( !editingCategory || c.id !== editingCategory.id) .map((c) => ({ label: c.name, value: c.id })); - const columns = [ + const columns = useMemo(() => [ { title: '分类名称', dataIndex: 'name', @@ -194,7 +194,7 @@ export default function ArticleCategoryManage() { ), }, - ]; + ], [isDark, categories, openEditModal, handleDelete]); return (
diff --git a/apps/web/src/pages/health/ArticleManageList.tsx b/apps/web/src/pages/health/ArticleManageList.tsx index e20dc87..bdfe37e 100644 --- a/apps/web/src/pages/health/ArticleManageList.tsx +++ b/apps/web/src/pages/health/ArticleManageList.tsx @@ -1,4 +1,4 @@ -import { useState, useEffect } from 'react'; +import { useState, useEffect, useMemo } from 'react'; import { useNavigate } from 'react-router-dom'; import { Table, @@ -242,7 +242,7 @@ export default function ArticleManageList() { // ---- 列定义 ---- - const columns = [ + const columns = useMemo(() => [ { title: '标题', dataIndex: 'title', @@ -351,7 +351,7 @@ export default function ArticleManageList() { width: 200, render: (_: unknown, record: ArticleListItem) => renderActions(record), }, - ]; + ], [navigate, renderActions]); return ( [ { title: '标签名称', dataIndex: 'name', @@ -165,7 +165,7 @@ export default function ArticleTagManage() { ), }, - ]; + ], [isDark, openEditModal, handleDelete]); return (
diff --git a/apps/web/src/pages/health/DoctorList.tsx b/apps/web/src/pages/health/DoctorList.tsx index 2434ad4..16c1d97 100644 --- a/apps/web/src/pages/health/DoctorList.tsx +++ b/apps/web/src/pages/health/DoctorList.tsx @@ -1,4 +1,4 @@ -import { useState, useCallback, useRef } from 'react'; +import { useState, useCallback, useRef, useMemo } from 'react'; import { Table, Button, @@ -199,7 +199,7 @@ export default function DoctorList() { }; // ---- 列定义 ---- - const columns = [ + const columns = useMemo(() => [ { title: '姓名', dataIndex: 'name', @@ -295,7 +295,7 @@ export default function DoctorList() { ), }, - ]; + ], [openEdit, handleDelete]); return ( [ { title: '日期', dataIndex: 'schedule_date', @@ -273,7 +273,7 @@ export default function DoctorSchedule() { ), }, - ]; + ], [openEdit]); // ---- 将日历数据转换为 CalendarView 所需格式 ---- const calendarScheduleMap: Record = {}; diff --git a/apps/web/src/pages/health/OfflineEventList.tsx b/apps/web/src/pages/health/OfflineEventList.tsx index 688d0ae..83a86c3 100644 --- a/apps/web/src/pages/health/OfflineEventList.tsx +++ b/apps/web/src/pages/health/OfflineEventList.tsx @@ -1,4 +1,4 @@ -import { useEffect, useState, useCallback } from 'react'; +import { useEffect, useState, useCallback, useMemo } from 'react'; import { Table, Button, @@ -166,7 +166,7 @@ export default function OfflineEventList() { }; // ---- 列定义 ---- - const columns = [ + const columns = useMemo(() => [ { title: '活动名称', dataIndex: 'title', @@ -279,7 +279,7 @@ export default function OfflineEventList() { ), }, - ]; + ], [openEdit, handleCheckin, handleDelete]); return ( diff --git a/apps/web/src/pages/health/PatientList.tsx b/apps/web/src/pages/health/PatientList.tsx index 35abe94..14060dc 100644 --- a/apps/web/src/pages/health/PatientList.tsx +++ b/apps/web/src/pages/health/PatientList.tsx @@ -1,4 +1,4 @@ -import { useState, useCallback, useRef } from 'react'; +import { useState, useCallback, useRef, useMemo } from 'react'; import { useNavigate } from 'react-router-dom'; import { Table, @@ -184,7 +184,7 @@ export default function PatientList() { // ---- 列定义 ---- - const columns = [ + const columns = useMemo(() => [ { title: '姓名', dataIndex: 'name', @@ -298,7 +298,7 @@ export default function PatientList() { ), }, - ]; + ], [openEditModal, handleDelete]); return ( [ { title: '患者姓名', dataIndex: 'name', @@ -191,7 +191,7 @@ export default function PatientTagManage() { ), }, - ]; + ], [isDark, allTags, openTagModal]); return (
diff --git a/apps/web/src/pages/health/PointsOrderList.tsx b/apps/web/src/pages/health/PointsOrderList.tsx index 9f45dec..d1e6ae9 100644 --- a/apps/web/src/pages/health/PointsOrderList.tsx +++ b/apps/web/src/pages/health/PointsOrderList.tsx @@ -1,4 +1,4 @@ -import { useState, useCallback } from 'react'; +import { useState, useCallback, useMemo } from 'react'; import { Table, Button, @@ -112,7 +112,7 @@ export default function PointsOrderList() { }; // ---- 列定义 ---- - const columns = [ + const columns = useMemo(() => [ { title: '订单号', dataIndex: 'id', @@ -198,7 +198,7 @@ export default function PointsOrderList() { ellipsis: true, render: (val: string | null) => val || '-', }, - ]; + ], [getPatientName]); return ( [ { title: '商品名称', dataIndex: 'name', @@ -270,7 +270,7 @@ export default function PointsProductList() { ), }, - ]; + ], [openEdit, handleToggleActive, handleDelete]); /** 抽屉表单分区 */ const formSections: FormSection[] = [ diff --git a/apps/web/src/pages/health/PointsRuleList.tsx b/apps/web/src/pages/health/PointsRuleList.tsx index 734c35e..970d0af 100644 --- a/apps/web/src/pages/health/PointsRuleList.tsx +++ b/apps/web/src/pages/health/PointsRuleList.tsx @@ -1,4 +1,4 @@ -import { useState, useCallback } from 'react'; +import { useState, useCallback, useMemo } from 'react'; import { Table, Button, @@ -184,7 +184,7 @@ export default function PointsRuleList() { }; // ---- 列定义 ---- - const columns = [ + const columns = useMemo(() => [ { title: '规则名称', dataIndex: 'name', @@ -286,7 +286,7 @@ export default function PointsRuleList() { ), }, - ]; + ], [openEdit, handleToggleActive, handleDelete]); return ( [ { title: '记录类型', dataIndex: 'record_type', key: 'record_type', width: 120, render: (v: string) => {RECORD_TYPE_MAP[v] || v} }, { title: '记录日期', dataIndex: 'record_date', key: 'record_date', width: 120 }, { title: '内容', dataIndex: 'content', key: 'content', ellipsis: true }, @@ -139,7 +139,7 @@ export function HealthRecordsTab({ patientId }: Props) { ), }, - ]; + ], [openEditModal, handleDelete]); return (
diff --git a/apps/web/src/pages/health/components/LabReportsTab.tsx b/apps/web/src/pages/health/components/LabReportsTab.tsx index 60e42b1..a04b2ca 100644 --- a/apps/web/src/pages/health/components/LabReportsTab.tsx +++ b/apps/web/src/pages/health/components/LabReportsTab.tsx @@ -1,4 +1,4 @@ -import { useCallback, useState } from 'react'; +import { useCallback, useState, useMemo } from 'react'; import { Table, Tag, Button, Modal, Form, Input, DatePicker, message, Popconfirm, Space } from 'antd'; import { PlusOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons'; import { dayjs } from '../../../utils/dayjs'; @@ -88,7 +88,7 @@ export function LabReportsTab({ patientId }: Props) { } }; - const columns = [ + const columns = useMemo(() => [ { title: '报告日期', dataIndex: 'report_date', key: 'report_date', width: 120 }, { title: '报告类型', dataIndex: 'report_type', key: 'report_type', width: 120, render: (v: string) => {v} }, { title: '医生解读', dataIndex: 'doctor_interpretation', key: 'doctor_interpretation', ellipsis: true }, @@ -112,7 +112,7 @@ export function LabReportsTab({ patientId }: Props) { ), }, - ]; + ], [openEditModal, handleDelete]); return (