feat(WEB): 종합분석 컴포넌트 개선
- 목데이터 적용 및 UI 개선
This commit is contained in:
@@ -280,28 +280,29 @@ export default function ComprehensiveAnalysis({ initialData }: ComprehensiveAnal
|
||||
const [rejectTargetId, setRejectTargetId] = useState<string | null>(null);
|
||||
const [rejectReason, setRejectReason] = useState('');
|
||||
|
||||
// 데이터 로드 (API 연동 시 활성화)
|
||||
// const loadData = useCallback(async () => {
|
||||
// setIsLoading(true);
|
||||
// try {
|
||||
// const result = await getComprehensiveAnalysis();
|
||||
// if (result.success && result.data) {
|
||||
// setData(result.data);
|
||||
// }
|
||||
// } catch (error) {
|
||||
// console.error('Failed to load comprehensive analysis:', error);
|
||||
// } finally {
|
||||
// setIsLoading(false);
|
||||
// }
|
||||
// }, []);
|
||||
|
||||
// 초기 로드 - 현재 목데이터 사용 중 (API 연동 시 활성화)
|
||||
useEffect(() => {
|
||||
// API 연동 시 아래 주석 해제
|
||||
// loadData();
|
||||
setIsLoading(false);
|
||||
// 데이터 로드
|
||||
const loadData = useCallback(async () => {
|
||||
setIsLoading(true);
|
||||
try {
|
||||
const result = await getComprehensiveAnalysis();
|
||||
if (result.success && result.data) {
|
||||
setData(result.data);
|
||||
} else if (result.error) {
|
||||
toast.error(result.error);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to load comprehensive analysis:', error);
|
||||
toast.error('데이터를 불러오는데 실패했습니다.');
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
}
|
||||
}, []);
|
||||
|
||||
// 초기 로드
|
||||
useEffect(() => {
|
||||
loadData();
|
||||
}, [loadData]);
|
||||
|
||||
const handleReceivableDetail = () => {
|
||||
router.push('/ko/accounting/receivables-status');
|
||||
};
|
||||
@@ -370,12 +371,41 @@ export default function ComprehensiveAnalysis({ initialData }: ComprehensiveAnal
|
||||
? data.todayIssue.items
|
||||
: data.todayIssue.items.filter(item => item.category === issueFilter);
|
||||
|
||||
if (isLoading) {
|
||||
return (
|
||||
<PageLayout>
|
||||
<PageHeader
|
||||
title="보고서 및 분석"
|
||||
description="종합 경영 분석 현황을 확인합니다."
|
||||
icon={BarChart3}
|
||||
/>
|
||||
<div className="flex items-center justify-center min-h-[400px]">
|
||||
<div className="flex flex-col items-center gap-4">
|
||||
<Loader2 className="h-8 w-8 animate-spin text-muted-foreground" />
|
||||
<p className="text-sm text-muted-foreground">데이터를 불러오는 중...</p>
|
||||
</div>
|
||||
</div>
|
||||
</PageLayout>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<PageLayout>
|
||||
<PageHeader
|
||||
title="보고서 및 분석"
|
||||
description="종합 경영 분석 현황을 확인합니다."
|
||||
icon={BarChart3}
|
||||
actions={
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
onClick={loadData}
|
||||
disabled={isLoading}
|
||||
>
|
||||
<RefreshCw className={cn("h-4 w-4 mr-2", isLoading && "animate-spin")} />
|
||||
새로고침
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
|
||||
<div className="space-y-6">
|
||||
|
||||
Reference in New Issue
Block a user