mirror of
https://gitee.com/xiongmao1988/rax-medical.git
synced 2025-08-24 13:04:57 +08:00
commit: 一期,修改版本号
This commit is contained in:
parent
7e38b7a511
commit
198ae7d820
|
@ -24,12 +24,34 @@ export function handleHttpUpload(options: any) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// export function handleHttpUploadUrl(options: any, url: string | undefined) {
|
||||||
|
// let formData = new FormData();
|
||||||
|
// formData.append('file', options.file);
|
||||||
|
// formData.append('dir', options.dir)
|
||||||
|
// return new Promise((resolve) => {
|
||||||
|
// try {
|
||||||
|
// request({
|
||||||
|
// url: url,
|
||||||
|
// method: 'post',
|
||||||
|
// headers: {
|
||||||
|
// 'Content-Type': 'multipart/form-data',
|
||||||
|
// },
|
||||||
|
// data: formData,
|
||||||
|
// }).then((res: any) => {
|
||||||
|
// resolve(res.data)
|
||||||
|
// });
|
||||||
|
// } catch (error) {
|
||||||
|
// resolve(error)
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
|
||||||
export function handleHttpUploadUrl(options: any, url: string | undefined) {
|
export function handleHttpUploadUrl(options: any, url: string | undefined) {
|
||||||
let formData = new FormData();
|
let formData = new FormData();
|
||||||
formData.append('file', options.file);
|
formData.append('file', options.file);
|
||||||
formData.append('dir', options.dir)
|
formData.append('dir', options.dir);
|
||||||
return new Promise((resolve) => {
|
|
||||||
try {
|
return new Promise((resolve, reject) => { // 使用 reject 来处理错误
|
||||||
request({
|
request({
|
||||||
url: url,
|
url: url,
|
||||||
method: 'post',
|
method: 'post',
|
||||||
|
@ -38,10 +60,16 @@ export function handleHttpUploadUrl(options: any, url: string | undefined) {
|
||||||
},
|
},
|
||||||
data: formData,
|
data: formData,
|
||||||
}).then((res: any) => {
|
}).then((res: any) => {
|
||||||
resolve(res.data)
|
if (res.data && res.data.code !== 0) {
|
||||||
|
// 如果返回的 code 不为 0,拒绝 Promise
|
||||||
|
reject(res.data);
|
||||||
|
} else {
|
||||||
|
// console.log(res.message);
|
||||||
|
resolve(res.message);
|
||||||
|
}
|
||||||
|
}).catch((error) => {
|
||||||
|
// 网络请求遇到其他错误时也拒绝 Promise
|
||||||
|
reject(error);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
} catch (error) {
|
|
||||||
resolve(error)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
Binary file not shown.
|
@ -62,21 +62,36 @@ const importData = () => {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
uploadRef.value.submit()
|
uploadRef.value.submit()
|
||||||
// emit('error')
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleUpload(options: any) {
|
function handleUpload(options: any) {
|
||||||
handleHttpUploadUrl(options, props.importUrl).then((res: any) => {
|
handleHttpUploadUrl(options, props.importUrl)
|
||||||
if (res.code == 0) {
|
.then((res: any) => {
|
||||||
ElMessage.success('上传成功')
|
console.log(res)
|
||||||
close()
|
if (res === 'Request failed with status code 403') {
|
||||||
emit('success')
|
ElMessage.error('上传失败,请检查权限信息')
|
||||||
} else {
|
return
|
||||||
ElMessage.error(res.msg ? res.msg : "上传失败")
|
|
||||||
emit("error");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ElMessage.success('上传成功');
|
||||||
|
close();
|
||||||
|
emit('success');
|
||||||
})
|
})
|
||||||
|
.catch((error: any) => {
|
||||||
|
// 处理错误
|
||||||
|
if (error.data && error.data.length > 0) {
|
||||||
|
const errorMessages = error.data
|
||||||
|
.map(item => `行 ${item.lineNum}: ${item.errors.join(', ')}`)
|
||||||
|
.join('; ');
|
||||||
|
ElMessage.error(`上传失败: ${errorMessages}`);
|
||||||
|
} else {
|
||||||
|
ElMessage.error(error.msg || '上传失败');
|
||||||
}
|
}
|
||||||
|
emit("error");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -3,14 +3,14 @@ import {Session} from "@/utils/storage";
|
||||||
import {ElMessage} from "element-plus";
|
import {ElMessage} from "element-plus";
|
||||||
|
|
||||||
// 本地调试版本:
|
// 本地调试版本:
|
||||||
// const vitalUrl = "ws://" + window.location.host + "/socket.io/admin/rax/vitalSignsMedicine?token=" + Session.getToken()
|
const vitalUrl = "ws://" + window.location.host + "/socket.io/admin/rax/vitalSignsMedicine?token=" + Session.getToken()
|
||||||
// // const medicineUrl = "ws://" + window.location.host + "/socket.io/admin/rax/addMedicine?token=" + Session.getToken()
|
// const medicineUrl = "ws://" + window.location.host + "/socket.io/admin/rax/addMedicine?token=" + Session.getToken()
|
||||||
// const chatUrl = "ws://" + window.location.host + "/socket.io/admin/rax/chatRoom?token=" + Session.getToken()
|
const chatUrl = "ws://" + window.location.host + "/socket.io/admin/rax/chatRoom?token=" + Session.getToken()
|
||||||
|
|
||||||
// 服务器部署版本
|
// 服务器部署版本
|
||||||
const vitalUrl = "wss://" + window.location.host + "/socket.io/admin/rax/vitalSignsMedicine?token=" + Session.getToken()
|
// const vitalUrl = "wss://" + window.location.host + "/socket.io/admin/rax/vitalSignsMedicine?token=" + Session.getToken()
|
||||||
// const medicineUrl = "wss://" + window.location.host + "/socket.io/admin/rax/addMedicine?token=" + Session.getToken()
|
// // const medicineUrl = "wss://" + window.location.host + "/socket.io/admin/rax/addMedicine?token=" + Session.getToken()
|
||||||
const chatUrl = "wss://" + window.location.host + "/socket.io/admin/rax/chatRoom?token=" + Session.getToken()
|
// const chatUrl = "wss://" + window.location.host + "/socket.io/admin/rax/chatRoom?token=" + Session.getToken()
|
||||||
|
|
||||||
// 测试echars
|
// 测试echars
|
||||||
// const vitalUrl = "wss://" + "110.41.142.124" + "/socket.io/admin/rax/vitalSignsMedicine?token=" + Session.getToken()
|
// const vitalUrl = "wss://" + "110.41.142.124" + "/socket.io/admin/rax/vitalSignsMedicine?token=" + Session.getToken()
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user