|
@@ -231,8 +231,8 @@ const loadUser = () => {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-// 获取当前用户ID
|
|
|
|
|
-const currentUserId = computed(() => user.value.id ? Number(user.value.id) : undefined)
|
|
|
|
|
|
|
+// 获取当前用户ID (保持为字符串以避免JavaScript Number精度问题)
|
|
|
|
|
+const currentUserId = computed(() => user.value.id || undefined)
|
|
|
|
|
|
|
|
const medications = ref<Medication[]>([])
|
|
const medications = ref<Medication[]>([])
|
|
|
|
|
|
|
@@ -474,9 +474,9 @@ const confirmAdd = async () => {
|
|
|
}
|
|
}
|
|
|
result = await updateMedication(editingId.value, payload)
|
|
result = await updateMedication(editingId.value, payload)
|
|
|
} else {
|
|
} else {
|
|
|
- // 添加用药
|
|
|
|
|
|
|
+ // 添加用药 (使用字符串类型的用户ID)
|
|
|
const payload = {
|
|
const payload = {
|
|
|
- patientUserId: currentUserId.value!,
|
|
|
|
|
|
|
+ patientUserId: currentUserId.value,
|
|
|
medicineName: selectedMedicine.value.name,
|
|
medicineName: selectedMedicine.value.name,
|
|
|
dosage: addDosage.value.trim(),
|
|
dosage: addDosage.value.trim(),
|
|
|
frequency: frequency,
|
|
frequency: frequency,
|
|
@@ -602,7 +602,8 @@ const loadMedications = async () => {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
- const result: any = await getMedicationListByPatientId(currentUserId.value!)
|
|
|
|
|
|
|
+ // 传递字符串类型的用户ID而不是Number类型
|
|
|
|
|
+ const result: any = await getMedicationListByPatientId(currentUserId.value)
|
|
|
|
|
|
|
|
if (result?.data?.code === 200) {
|
|
if (result?.data?.code === 200) {
|
|
|
medications.value = result.data.data.map((item: any) => ({
|
|
medications.value = result.data.data.map((item: any) => ({
|