完成93需求

This commit is contained in:
chenjinyang
2026-02-05 16:30:25 +08:00
parent f69de5e78f
commit dfdab41c00
30 changed files with 3104 additions and 18 deletions

View File

@@ -6,6 +6,10 @@ import {blobValidate, tansParams} from '@/utils/openhis'
import cache from '@/plugins/cache'
import {saveAs} from 'file-saver'
import useUserStore from '@/store/modules/user'
import JSONBig from 'json-bigint'
// 初始化json-bigint配置大数字转字符串关键storeAsString: true
const jsonBig = JSONBig({ storeAsString: true })
let downloadLoadingInstance;
// 是否显示重新登录
@@ -17,10 +21,26 @@ axios.defaults.headers['X-Tenant-ID'] = import.meta.env.VITE_APP_TENANT_ID || '1
axios.defaults.headers['Request-Method-Name'] = 'login'
// 创建axios实例
const service = axios.create({
// axios中请求配置有baseURL选项表示请求URL公共部分
baseURL: import.meta.env.VITE_APP_BASE_API,
// 超时
timeout: 60000
timeout: 60000,
// 新增:重写响应解析逻辑,大数字自动转字符串(移到这里!)
transformResponse: [
function (data) {
if (!data) return {} // 空数据直接返回,避免解析报错
try {
return jsonBig.parse(data)
} catch (err) {
// 解析失败时用默认方式,兼容特殊情况
return JSON.parse(data)
}
}
],
// 可选:请求体序列化,无需额外处理,默认即可(保留也不影响)
transformRequest: [
function (data) {
return JSON.stringify(data)
}
]
})
// request拦截器