医生排班日期的正确插入
This commit is contained in:
@@ -25,6 +25,15 @@ export function addDoctorSchedule(data) {
|
||||
})
|
||||
}
|
||||
|
||||
// 添加医生排班(带具体日期)
|
||||
export function addDoctorScheduleWithDate(data) {
|
||||
return request({
|
||||
url: '/appointment/doctor-schedule/add-with-date',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 更新医生排班
|
||||
export function updateDoctorSchedule(data) {
|
||||
return request({
|
||||
|
||||
@@ -13,6 +13,19 @@ export function addDoctorSchedule(data) {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加医生排班(带具体日期)
|
||||
* @param {Object} data - 排班数据
|
||||
* @returns {Promise}
|
||||
*/
|
||||
export function addDoctorScheduleWithDate(data) {
|
||||
return request({
|
||||
url: '/doctor-schedule/add-with-date',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新医生排班
|
||||
* @param {Object} data - 排班数据 (必须包含ID)
|
||||
|
||||
@@ -239,7 +239,7 @@ import {computed, onMounted, ref, watch} from 'vue'
|
||||
import {useRoute, useRouter} from 'vue-router'
|
||||
import {ElDialog, ElMessage, ElMessageBox} from 'element-plus'
|
||||
import {View} from '@element-plus/icons-vue'
|
||||
import {addDoctorSchedule, deleteDoctorSchedule} from '../api'
|
||||
import {addDoctorSchedule, addDoctorScheduleWithDate, deleteDoctorSchedule} from '../api'
|
||||
|
||||
// 路由和导航
|
||||
const route = useRoute()
|
||||
@@ -587,6 +587,7 @@ const handleSave = async () => {
|
||||
isStopped: item.stopClinic || false,
|
||||
stopReason: item.stopClinic ? (item.stopReason || '') : '',
|
||||
deptId: currentDept.value?.id || route.query.deptId || null,
|
||||
scheduledDate: item.date // 添加具体日期字段
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -608,13 +609,14 @@ const handleSave = async () => {
|
||||
let successCount = 0
|
||||
let failCount = 0
|
||||
const errors = []
|
||||
|
||||
|
||||
for (const { localIndex, localId, scheduleData } of newSchedulesToSave) {
|
||||
try {
|
||||
// 确保新记录的id为null
|
||||
scheduleData.id = null
|
||||
|
||||
const res = await addDoctorSchedule(scheduleData)
|
||||
|
||||
// 使用带日期的API,日期信息已包含在scheduleData中
|
||||
const res = await addDoctorScheduleWithDate(scheduleData)
|
||||
if (res.code === 200 && res.data) {
|
||||
successCount++
|
||||
// 更新本地记录的backendId
|
||||
|
||||
@@ -377,7 +377,7 @@ import {ElDialog, ElForm, ElFormItem, ElInput, ElMessage, ElMessageBox, ElOption
|
||||
import {DocumentRemove, EditPen, View, Delete} from '@element-plus/icons-vue'
|
||||
import {listDept, searchDept} from '@/api/appoinmentmanage/dept'
|
||||
import {getLocationTree, getPractitionerMetadata, getHealthcareMetadata} from '@/views/charge/outpatientregistration/components/outpatientregistration'
|
||||
import {addDoctorSchedule, updateDoctorSchedule, deleteDoctorSchedule, getRegisterOrganizations, getDoctorScheduleListByDeptId} from './api'
|
||||
import {addDoctorSchedule, addDoctorScheduleWithDate, updateDoctorSchedule, deleteDoctorSchedule, getRegisterOrganizations, getDoctorScheduleListByDeptId} from './api'
|
||||
import {getClinicRoomList} from '@/api/appoinmentmanage/clinicRoom'
|
||||
import {getInitOption, getRegistrationItems, getClinicItems} from '@/views/basicservices/registrationfee/components/registrationfee'
|
||||
import { deptTreeSelect } from '@/api/system/user'
|
||||
@@ -1534,6 +1534,7 @@ const handleSave = async () => {
|
||||
isStopped: item.stopClinic,
|
||||
stopReason: item.stopClinic ? (item.stopReason || '') : '',
|
||||
deptId: currentDept.value?.id || null,
|
||||
scheduledDate: item.date // 添加具体日期字段
|
||||
};
|
||||
if (item.backendId) {
|
||||
scheduleData.id = item.backendId;
|
||||
@@ -1557,7 +1558,7 @@ const handleSave = async () => {
|
||||
// 处理新增
|
||||
for (const { scheduleData } of recordsToAdd) {
|
||||
try {
|
||||
const res = await addDoctorSchedule(scheduleData);
|
||||
const res = await addDoctorScheduleWithDate(scheduleData);
|
||||
if (res.code === 200) {
|
||||
addSuccess++;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user