WXL
2 天以前 6f1b2cf3dc89059104ca0eedebf5f3ec4d1147f0
打印
已修改2个文件
47 ■■■■■ 文件已修改
src/views/ecg/doctor/components/RoutinePanel.vue 45 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
vite.config.ts 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/ecg/doctor/components/RoutinePanel.vue
@@ -266,10 +266,51 @@
  formRef.value?.resetFields()
}
const yddownload = async () => {
  await DoctorApi.yddownload(props.setappointmentId)
  const obj = await DoctorApi.yddownload(props.setappointmentId)
  console.log(obj,'xml');
  downloadWordFile(obj, '平板运动心电图知情同意书.doc');
}
const sgdownload = async () => {
  await DoctorApi.sgdownload(props.setappointmentId)
  const obj = await DoctorApi.sgdownload(props.setappointmentId)
  downloadWordFile(obj, '食管心脏电生理诊疗知情同意书.doc');
}
const downloadWordFile = (data, filename = 'document') => {
  try {
    // 1. 确保文件名以.doc结尾
    if (!filename.endsWith('.doc')) {
      filename += '.doc'
    }
    // 2. 创建Blob对象,指定MIME类型为Word文档[9,10](@ref)
    // 对于Word 2003 XML格式,使用'application/msword'
    const blob = new Blob([data], { type: 'application/msword' })
    // 3. 为Blob对象创建一个临时的下载URL[8,10](@ref)
    const url = URL.createObjectURL(blob)
    // 4. 创建一个隐藏的不可见的<a>链接元素[10](@ref)
    const link = document.createElement('a')
    link.style.display = 'none' // 隐藏链接
    link.href = url
    link.download = filename // 设置下载的文件名
    // 5. 将链接添加到DOM中,模拟点击,然后移除它[10](@ref)
    document.body.appendChild(link)
    link.click()
    document.body.removeChild(link)
    // 6. 释放URL对象以释放内存[9,10](@ref)
    // 使用setTimeout确保下载触发后再释放
    setTimeout(() => {
      URL.revokeObjectURL(url)
    }, 100)
    console.log('文件下载已触发!')
  } catch (error) {
    console.error('下载文件时发生错误:', error)
    // 这里可以添加更友好的用户错误提示,例如使用alert或页面弹窗
  }
}
const getRentInfoByPatId = () => {
  const tempPatId = formData.value.patId
vite.config.ts
@@ -33,7 +33,7 @@
        ['/admin-api']: {
          // target: 'http://192.168.100.120:48080',
          target: 'http://localhost:8095',
          // target: 'http://192.168.100.194:48080',
          // target: 'http://192.168.100.141:48080',
          ws: false,
          changeOrigin: true,
          // rewrite: (path) => path.replace(new RegExp(`^/admin-api`), ''),