完善B1看板数据
This commit is contained in:
@@ -823,10 +823,14 @@ export type UserOwnedMenusResponse = CommonActionResult<OutputUserOwnedMenus>;
|
||||
* B1服务点信息
|
||||
*/
|
||||
export interface B1ServiceInfo {
|
||||
/** 科室代码 */
|
||||
dept_code?: string | null;
|
||||
/** 科室名称 */
|
||||
dept_name?: string | null;
|
||||
/** 医生名称 */
|
||||
doctor_name?: string | null;
|
||||
/** 已完成客户数 */
|
||||
completed_customer_count?: number | null;
|
||||
/** 已检部位数 */
|
||||
exam_part_count?: number | null;
|
||||
/** 总时长(分钟) */
|
||||
@@ -846,8 +850,14 @@ export interface InputB1ServiceBoard {
|
||||
* B1服务看板出参
|
||||
*/
|
||||
export interface OutputB1ServiceBoard {
|
||||
/** 总客户数 */
|
||||
total_customer_count?: number | null;
|
||||
/** 等待体检客户数 */
|
||||
waiting_exam_count?: number | null;
|
||||
/** 体检中客户数 */
|
||||
in_exam_count?: number | null;
|
||||
/** B1服务点信息列表 */
|
||||
b1_service_info_list: B1ServiceInfo[];
|
||||
b1_service_info_list?: B1ServiceInfo[] | null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useEffect, useMemo, useState } from 'react';
|
||||
import { getRevenueStatistics, getTodayExamStatistics, getUserOwnedMenus, getB1ServiceBoard, getNorth3ServiceBoard } from '../../api';
|
||||
import type { B1ServiceInfo, OutputNorth3ServiceBoard } from '../../api/types';
|
||||
import type { OutputB1ServiceBoard, OutputNorth3ServiceBoard } from '../../api/types';
|
||||
import { Card, CardContent, CardHeader, InfoCard } from '../ui';
|
||||
import { cleanLocalStorageIfNeeded } from '../../utils/clean';
|
||||
|
||||
@@ -26,7 +26,7 @@ export const HomeSection = () => {
|
||||
{ label: '当日缺口', value: '¥ 0' },
|
||||
]);
|
||||
const [showRevenueStats, setShowRevenueStats] = useState(false);
|
||||
const [b1ServiceList, setB1ServiceList] = useState<B1ServiceInfo[]>([]);
|
||||
const [b1Data, setB1Data] = useState<OutputB1ServiceBoard | null>(null);
|
||||
const [b1Loading, setB1Loading] = useState(false);
|
||||
const [north3Data, setNorth3Data] = useState<OutputNorth3ServiceBoard | null>(null);
|
||||
const [north3Loading, setNorth3Loading] = useState(false);
|
||||
@@ -112,26 +112,19 @@ export const HomeSection = () => {
|
||||
getB1ServiceBoard({})
|
||||
.then((res) => {
|
||||
if (res.Status === 200 && res.Data) {
|
||||
setB1ServiceList(res.Data.b1_service_info_list || []);
|
||||
setB1Data(res.Data);
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error('获取B1服务看板失败', err);
|
||||
setB1ServiceList([]);
|
||||
setB1Data(null);
|
||||
})
|
||||
.finally(() => {
|
||||
setB1Loading(false);
|
||||
});
|
||||
}, []);
|
||||
|
||||
// 计算B1汇总信息
|
||||
const b1Summary = useMemo(() => {
|
||||
const totalClients = b1ServiceList.length;
|
||||
// 由于接口没有返回"在检"和"待检"数据,这里暂时使用0
|
||||
const waiting = 0;
|
||||
const inExam = 0;
|
||||
return { totalClients, waiting, inExam };
|
||||
}, [b1ServiceList]);
|
||||
const b1ServiceList = b1Data?.b1_service_info_list || [];
|
||||
|
||||
useEffect(() => {
|
||||
setNorth3Loading(true);
|
||||
@@ -181,9 +174,9 @@ export const HomeSection = () => {
|
||||
<CardHeader>B1 服务看板</CardHeader>
|
||||
<CardContent>
|
||||
<div className='grid grid-cols-3 gap-3 mb-3'>
|
||||
<InfoCard label='客户总数' value={b1Summary.totalClients} />
|
||||
<InfoCard label='待检人数' value={b1Summary.waiting} />
|
||||
<InfoCard label='已检人数' value={b1Summary.inExam} />
|
||||
<InfoCard label='客户总数' value={b1Data?.total_customer_count ?? 0} />
|
||||
<InfoCard label='待检人数' value={b1Data?.waiting_exam_count ?? 0} />
|
||||
<InfoCard label='在检人数' value={b1Data?.in_exam_count ?? 0} />
|
||||
</div>
|
||||
{b1Loading ? (
|
||||
<div className='text-center text-gray-500 py-4'>加载中...</div>
|
||||
@@ -208,10 +201,10 @@ export const HomeSection = () => {
|
||||
<tr key={`${item.dept_name}-${item.doctor_name}-${index}`} className='border-b last:border-b-0'>
|
||||
<td className='py-2'>{item.dept_name || '-'}</td>
|
||||
<td className='py-2'>{item.doctor_name || '-'}</td>
|
||||
<td className='py-2 text-right'>-</td>
|
||||
<td className='py-2 text-right'>{item.completed_customer_count ?? '-'}</td>
|
||||
<td className='py-2 text-right'>{item.exam_part_count ?? '-'}</td>
|
||||
<td className='py-2 text-right'>{item.total_duration_minutes ?? '-'}</td>
|
||||
<td className='py-2 text-right'>{item.average_duration_minutes ?? '-'}</td>
|
||||
<td className='py-2 text-right'>{item.total_duration_minutes !== null && item.total_duration_minutes !== undefined ? `${item.total_duration_minutes}分钟` : '-'}</td>
|
||||
<td className='py-2 text-right'>{item.average_duration_minutes !== null && item.average_duration_minutes !== undefined ? `${item.average_duration_minutes}分钟` : '-'}</td>
|
||||
<td className='py-2 text-right'>-</td>
|
||||
<td className='py-2 text-right'>-</td>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user