Files
Home-Care/hss-home-service/website/components/DataDashboard.vue
comclib 01e1034cc1 feat: 全系统优化 — 并发控制 + 冗余清理 + 数据流修复 + 全面测试
核心修复:
- 状态机加 SELECT FOR UPDATE 行锁,消除并发竞态
- hss_md_staff 加 role 列,登录从数据库读取真实角色
- 申请重复校验排除自身,全流程 20 步闭环通过
- 派单 SQL 修复 + 支付状态机过渡 + 完成服务 plan_item_id 修复

并发控制新增:
- RedisLockService (SET NX PX + Lua 安全解锁)
- RateLimiterService (Redis 滑动窗口 + API 拦截器)
- TransactionIsolationConfig (SERIALIZABLE for 支付回调)
- MqttPublisher (异步队列 + JDK TCP 探测)
- ObjectStorageService (AWS SigV4 预签名, 纯 JDK)

冗余清理:
- 删除 6 个死代码文件 (~620 行)
- hutool-all → JDK MessageDigest, 去 MapStruct, 去 jsr310
- haversine 提取到 GeoUtil, count/round 提取到 JdbcUtil
- 创建 platform layout 组件

前端修复:
- 登录页移除角色选择器, 由后端 JWT 返回
- 移除 ClientOnly 包裹, 页面正常渲染
- SPA fallback Nginx 配置修复

Docker: 运行时镜像 eclipse-temurin:17-jre-jammy (缩小 ~300MB)

文档: 新增系统实现与修复报告.md

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-22 11:48:07 +08:00

66 lines
2.2 KiB
Vue

<script setup lang="ts">
import { ref, onMounted } from 'vue'
import { useApi } from '~/composables/useApi'
const { get } = useApi()
const stats = ref([
{ label: '今日工单', value: 0, suffix: '单' },
{ label: '进行中', value: 0, suffix: '单' },
{ label: '服务完成率', value: 0, suffix: '%' },
{ label: '异常工单', value: 0, suffix: '单' },
])
function animate(el: { value: number }, target: number, duration = 1200) {
const start = performance.now()
function tick(now: number) {
const p = Math.min((now - start) / duration, 1)
const rounded = Math.round(target * p * 10) / 10
if (target - rounded < 1) { el.value = target; return }
el.value = rounded
if (p < 1) requestAnimationFrame(tick)
}
requestAnimationFrame(tick)
}
onMounted(async () => {
try {
const [d, q] = await Promise.all([
get<any>('/admin/dashboard').catch(() => ({})),
get<any>('/analytics/quality').catch(() => ({})),
])
const targets = [
(d?.todayOrders as number) || 0,
(d?.inProgress as number) || 0,
(q?.serviceCompletionRate as number) || 0,
(d?.exceptions as number) || 0,
]
const obs = new IntersectionObserver((entries) => {
entries.forEach(e => {
if (e.isIntersecting) {
stats.value.forEach((s, i) => { s.value = 0; animate(s, targets[i]) })
obs.disconnect()
}
})
}, { threshold: 0.3 })
const el = document.querySelector('#dashboard-section')
if (el) obs.observe(el)
} catch (_) {}
})
</script>
<template>
<div id="dashboard-section" class="space-y-6">
<div class="grid grid-cols-2 lg:grid-cols-4 gap-4">
<div v-for="s in stats" :key="s.label" class="bg-white rounded-2xl p-6 text-center shadow-sm border border-gray-50">
<div class="text-3xl font-bold font-mono text-primary mb-2">
{{ s.value }}{{ s.suffix }}
</div>
<div class="text-sm text-text-secondary">{{ s.label }}</div>
</div>
</div>
<img src="/placeholders/platform-overview.svg" alt="数据看板示意图(示意素材,待替换)"
class="w-full rounded-xl shadow-sm" width="960" height="300" loading="lazy" />
</div>
</template>