调整
This commit is contained in:
parent
27a821e585
commit
19ea04b0b2
@ -1465,44 +1465,32 @@ const handleApply = async (row) => {
|
||||
/** 查看报告 */
|
||||
const handleViewReport = async (row) => {
|
||||
try {
|
||||
// 显示加载提示
|
||||
const loading = ElLoading.service({
|
||||
lock: true,
|
||||
text: '正在加载报告...',
|
||||
background: 'rgba(0, 0, 0, 0.8)'
|
||||
// 调用接口查询报告
|
||||
const result = await EcgworkstationApi.getPdfUrl({
|
||||
orgid: row.orgid,
|
||||
examid: row.examid
|
||||
})
|
||||
|
||||
try {
|
||||
// 调用接口查询报告
|
||||
const result = await EcgworkstationApi.getPdfUrl({
|
||||
orgid: row.orgid,
|
||||
examid: row.examid
|
||||
// 处理API返回结果:可能是字符串URL或包含data字段的对象
|
||||
let pdfUrl = ''
|
||||
if (typeof result === 'string') {
|
||||
// API直接返回字符串URL
|
||||
pdfUrl = result.replace(/`/g, '').trim()
|
||||
} else if (result && result.data) {
|
||||
// API返回对象,从data字段获取URL
|
||||
pdfUrl = result.data.replace(/`/g, '').trim()
|
||||
}
|
||||
|
||||
if (pdfUrl) {
|
||||
// 直接打开新窗口显示报告
|
||||
openReportWindow(pdfUrl, row)
|
||||
} else {
|
||||
console.warn('API返回数据异常:', {
|
||||
result,
|
||||
resultType: typeof result,
|
||||
hasData: !!result?.data
|
||||
})
|
||||
|
||||
// 处理API返回结果:可能是字符串URL或包含data字段的对象
|
||||
let pdfUrl = ''
|
||||
if (typeof result === 'string') {
|
||||
// API直接返回字符串URL
|
||||
pdfUrl = result.replace(/`/g, '').trim()
|
||||
} else if (result && result.data) {
|
||||
// API返回对象,从data字段获取URL
|
||||
pdfUrl = result.data.replace(/`/g, '').trim()
|
||||
}
|
||||
|
||||
if (pdfUrl) {
|
||||
console.log('处理后的PDF URL:', pdfUrl)
|
||||
// 直接打开新窗口显示报告
|
||||
openReportWindow(pdfUrl, row)
|
||||
} else {
|
||||
console.warn('API返回数据异常:', {
|
||||
result,
|
||||
resultType: typeof result,
|
||||
hasData: !!result?.data
|
||||
})
|
||||
ElMessage.warning('报告未生成或查询失败')
|
||||
}
|
||||
} finally {
|
||||
loading.close()
|
||||
ElMessage.warning('报告未生成或查询失败')
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('查询报告失败:', error)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user