|
|
@@ -147,7 +147,9 @@ const Dashboard: React.FC = () => {
|
|
|
try {
|
|
|
await Promise.all([
|
|
|
queryClient.invalidateQueries({ queryKey: ['enterpriseOverview'] }),
|
|
|
- queryClient.invalidateQueries({ queryKey: ['recentAllocations'] })
|
|
|
+ queryClient.invalidateQueries({ queryKey: ['recentAllocations'] }),
|
|
|
+ queryClient.invalidateQueries({ queryKey: ['dashboard', 'employment-rate'] }),
|
|
|
+ queryClient.invalidateQueries({ queryKey: ['dashboard', 'average-salary'] })
|
|
|
])
|
|
|
} finally {
|
|
|
Taro.stopPullDownRefresh()
|
|
|
@@ -371,17 +373,23 @@ const Dashboard: React.FC = () => {
|
|
|
<View className="pulse-dot mr-2" />
|
|
|
<Text className="text-sm text-gray-600">在职率</Text>
|
|
|
</View>
|
|
|
- <Text className="text-2xl font-bold text-gray-800">
|
|
|
- {overview?.totalEmployees ? '92%' : '--'}
|
|
|
- </Text>
|
|
|
+ {isLoadingEmploymentRate ? (
|
|
|
+ <Text className="text-2xl font-bold text-gray-400">加载中...</Text>
|
|
|
+ ) : !isEmploymentRateSuccess(employmentRateData) ? (
|
|
|
+ <Text className="text-2xl font-bold text-gray-400">--</Text>
|
|
|
+ ) : (
|
|
|
+ <Text className="text-2xl font-bold text-gray-800">{employmentRateData.rate ?? 0}%</Text>
|
|
|
+ )}
|
|
|
</View>
|
|
|
<View className="stat-card bg-white p-4 rounded-lg flex flex-col items-center">
|
|
|
<Text className="text-sm text-gray-600 mb-2">平均薪资</Text>
|
|
|
- <Text className="text-2xl font-bold text-gray-800">
|
|
|
- {allocations && allocations.length > 0
|
|
|
- ? `¥${Math.round(allocations.reduce((sum: number, a: AllocationData) => sum + a.salary, 0) / allocations.length).toLocaleString()}`
|
|
|
- : '¥0'}
|
|
|
- </Text>
|
|
|
+ {isLoadingAverageSalary ? (
|
|
|
+ <Text className="text-2xl font-bold text-gray-400">加载中...</Text>
|
|
|
+ ) : !isAverageSalarySuccess(averageSalaryData) ? (
|
|
|
+ <Text className="text-2xl font-bold text-gray-400">--</Text>
|
|
|
+ ) : (
|
|
|
+ <Text className="text-2xl font-bold text-gray-800">¥{(averageSalaryData.average ?? 0).toLocaleString()}</Text>
|
|
|
+ )}
|
|
|
</View>
|
|
|
</View>
|
|
|
</View>
|