fix(emr): 在归档页面添加数据同步按钮

- 添加'同步历史数据'按钮到归档页面
- 点击按钮可直接触发EMR数据同步
- 无需访问单独的同步页面
This commit is contained in:
2026-06-21 13:48:44 +08:00
parent 732e4f5ffd
commit f0a71700e4

View File

@@ -2,12 +2,22 @@
<div style="padding:16px">
<div style="margin-bottom:16px;display:flex;justify-content:space-between;align-items:center">
<span style="font-size:18px;font-weight:bold">病历打印归档</span>
<el-button
type="primary"
@click="loadStats"
>
刷新统计
</el-button>
<div>
<el-button
type="warning"
:loading="syncing"
@click="handleSync"
style="margin-right:10px"
>
{{ syncing ? '同步中...' : '同步历史数据' }}
</el-button>
<el-button
type="primary"
@click="loadStats"
>
刷新统计
</el-button>
</div>
</div>
<el-row
:gutter="12"
@@ -229,13 +239,28 @@ import {ref,onMounted} from 'vue'
import {useRoute} from 'vue-router'
import {ElMessage,ElMessageBox} from 'element-plus'
import {getArchivePage,archive,reprint,getArchiveStats} from './api'
import request from '@/utils/request'
const route=useRoute()
const tableData=ref([]);const total=ref(0);const stats=ref({})
const syncing=ref(false)
const q=ref({pageNo:1,pageSize:20,patientName:'',archiveStatus:''})
const loadData=async()=>{const r=await getArchivePage(q.value);tableData.value=r.data?.records||[];total.value=r.data?.total||0}
const loadStats=async()=>{const r=await getArchiveStats();stats.value=r.data||{}}
const doArchive=async(row)=>{const {value}=await ElMessageBox.prompt('归档人','确认归档');if(value){await archive(row.id,value);ElMessage.success('已归档');loadData();loadStats()}}
const doReprint=async(row)=>{await reprint(row.id);ElMessage.success('补打记录已添加');loadData()}
const handleSync=async()=>{
try{
await ElMessageBox.confirm('将从病历表同步数据到修订历史和搜索索引,确定继续?','确认同步',{type:'warning'})
syncing.value=true
const res=await request({url:'/emr-sync/sync',method:'post'})
ElMessage.success(res.data||'同步完成')
loadData();loadStats()
}catch(e){
if(e!=='cancel') ElMessage.error('同步失败')
}finally{
syncing.value=false
}
}
onMounted(()=>{
if(route.query.encounterId){q.value.encounterId=route.query.encounterId}
if(route.query.patientName){q.value.patientName=route.query.patientName}