221,222,223,224,227,228,229,230,231
This commit is contained in:
@@ -331,7 +331,7 @@
|
||||
type="danger"
|
||||
size="small"
|
||||
@click="handleDeleteSchedule(scope.row)"
|
||||
:disabled="!isEditMode"
|
||||
:disabled="!isEditMode || isLastDraftRowInSlot(scope.row)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
@@ -430,7 +430,7 @@ const currentDept = ref(null)
|
||||
|
||||
// 筛选参数
|
||||
const filterParams = ref({
|
||||
orgName: '演示医院',
|
||||
orgName: '',
|
||||
deptName: '测试内科',
|
||||
clinicRoomName: '', // 添加诊室名称过滤字段
|
||||
startDate: new Date(),
|
||||
@@ -505,9 +505,9 @@ const fetchDoctorList = async (orgId) => {
|
||||
|
||||
console.log('原始医生数据:', doctorList)
|
||||
|
||||
// 将医生数据按类型分组
|
||||
const ordinaryDoctors = []
|
||||
const expertDoctors = []
|
||||
// 医生下拉统一展示:普通/专家都显示同一批医生
|
||||
// 排班回显仍按 schedule.regType 过滤,不受这里影响
|
||||
const allDoctors = []
|
||||
|
||||
doctorList.forEach(doctor => {
|
||||
// 不再单独检查医生的org_id是否与当前科室匹配
|
||||
@@ -520,29 +520,26 @@ const fetchDoctorList = async (orgId) => {
|
||||
orgId: doctor.orgId
|
||||
}
|
||||
|
||||
ordinaryDoctors.push(doctorInfo)
|
||||
|
||||
// 如果有专家类型的判断逻辑,可以在这里添加
|
||||
// 示例:如果职称包含"主任"或"教授"等关键词,则归为专家
|
||||
if (doctor.drProfttlCode && (doctor.drProfttlCode.includes('主任') || doctor.drProfttlCode.includes('教授'))) {
|
||||
expertDoctors.push(doctorInfo)
|
||||
}
|
||||
allDoctors.push(doctorInfo)
|
||||
})
|
||||
|
||||
// 更新医生选项
|
||||
doctorOptions.value['普通'] = ordinaryDoctors
|
||||
doctorOptions.value['专家'] = expertDoctors.length > 0 ? expertDoctors : [...ordinaryDoctors]
|
||||
const uniqueDoctors = Array.from(
|
||||
new Map(allDoctors.map(doc => [doc.id, doc])).values()
|
||||
)
|
||||
|
||||
// 更新医生选项
|
||||
doctorOptions.value['普通'] = uniqueDoctors
|
||||
doctorOptions.value['专家'] = uniqueDoctors
|
||||
|
||||
console.log('最终的医生列表:', doctorOptions.value)
|
||||
} else {
|
||||
console.error('获取医生列表失败:', response.msg)
|
||||
|
||||
doctorOptions.value = {
|
||||
'普通': [],
|
||||
'专家': []
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取医生列表异常:', error)
|
||||
|
||||
doctorOptions.value = {
|
||||
'普通': [],
|
||||
'专家': []
|
||||
@@ -693,7 +690,7 @@ const fetchClinicItems = async (deptId = null) => {
|
||||
|
||||
// 根据排班类型获取医生选项
|
||||
const getDoctorOptions = (appointmentType) => {
|
||||
return doctorOptions.value[appointmentType] || doctorOptions.value['普通']
|
||||
return doctorOptions.value[appointmentType] || []
|
||||
}
|
||||
|
||||
// 排班列表数据
|
||||
@@ -772,10 +769,6 @@ const fetchOrganizationList = async () => {
|
||||
}
|
||||
});
|
||||
|
||||
// 添加默认的机构选项(如"中联医院"、"演示医院"等)
|
||||
const defaultOrgs = ['中联医院', '演示医院']; // 可以根据需要添加更多默认选项
|
||||
defaultOrgs.forEach(org => uniqueOrgNames.add(org));
|
||||
|
||||
// 将机构名称转换为下拉选项格式
|
||||
organizationOptions.value = Array.from(uniqueOrgNames).map((orgName, index) => ({
|
||||
id: index, // 使用索引作为ID,因为我们只需要名称
|
||||
@@ -783,36 +776,27 @@ const fetchOrganizationList = async () => {
|
||||
orgName: orgName
|
||||
}));
|
||||
} else {
|
||||
console.error('获取卫生机构列表失败:', response.msg)
|
||||
// 如果获取数据失败,至少显示默认选项
|
||||
const defaultOrgs = ['中联医院', '演示医院'];
|
||||
organizationOptions.value = defaultOrgs.map((orgName, index) => ({
|
||||
id: index,
|
||||
name: orgName,
|
||||
orgName: orgName
|
||||
}));
|
||||
organizationOptions.value = []
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取卫生机构列表失败:', error)
|
||||
// 如果出现异常,至少显示默认选项
|
||||
const defaultOrgs = ['中联医院', '演示医院'];
|
||||
organizationOptions.value = defaultOrgs.map((orgName, index) => ({
|
||||
id: index,
|
||||
name: orgName,
|
||||
orgName: orgName
|
||||
}));
|
||||
organizationOptions.value = []
|
||||
}
|
||||
}
|
||||
|
||||
// 获取科室列表(通用方法)
|
||||
const fetchDeptList = async (apiFunction) => {
|
||||
try {
|
||||
// 复制查询参数
|
||||
// 统一查询参数口径:后端使用 name 作为科室名称条件
|
||||
const params = {
|
||||
...queryParams.value,
|
||||
pageNum: pagination.value.currentPage, // 修正为 pageNum
|
||||
pageNum: pagination.value.currentPage,
|
||||
pageSize: pagination.value.pageSize
|
||||
};
|
||||
if (queryParams.value.orgName) {
|
||||
params.orgName = queryParams.value.orgName;
|
||||
}
|
||||
if (queryParams.value.deptName) {
|
||||
params.name = queryParams.value.deptName;
|
||||
}
|
||||
|
||||
// 同时获取配置数据,分页大小与主列表保持一致
|
||||
// 这样既解决了 9999 导致的性能问题,又保证了当前显示行的数据完整性
|
||||
@@ -899,9 +883,9 @@ const getDeptList = async () => {
|
||||
}
|
||||
|
||||
// 查询
|
||||
const handleQuery = () => {
|
||||
const handleQuery = async () => {
|
||||
pagination.value.currentPage = 1;
|
||||
fetchDeptList(getRegisterOrganizations); // 使用挂号科室API
|
||||
await fetchDeptList(getRegisterOrganizations); // 使用挂号科室API
|
||||
}
|
||||
|
||||
// 处理卫生机构选择变化
|
||||
@@ -914,13 +898,14 @@ const handleOrgChange = async (orgName) => {
|
||||
}
|
||||
|
||||
// 重置
|
||||
const handleReset = () => {
|
||||
const handleReset = async () => {
|
||||
queryParams.value = {
|
||||
orgName: '',
|
||||
deptName: ''
|
||||
}
|
||||
pagination.value.currentPage = 1
|
||||
getDeptList()
|
||||
await fetchDepartmentOptions()
|
||||
await getDeptList()
|
||||
}
|
||||
|
||||
// 预约设置弹窗显示
|
||||
@@ -1015,85 +1000,104 @@ const reloadScheduleData = async () => {
|
||||
const row = currentDept.value
|
||||
if (!row) return
|
||||
|
||||
// 使用组件级别的 workTimeConfig
|
||||
const weekSchedule = generateWeekSchedule(filterParams.value.startDate, workTimeConfig.value)
|
||||
|
||||
// 计算当前周的起止日期,用于联表查询
|
||||
const startDateStr = formatDateStr(filterParams.value.startDate)
|
||||
const endDate = new Date(filterParams.value.startDate)
|
||||
endDate.setDate(endDate.getDate() + 6)
|
||||
const endDateStr = formatDateStr(endDate)
|
||||
|
||||
// 获取该科室在指定日期范围内的排班数据(联表查询 adm_schedule_pool 获取具体日期)
|
||||
try {
|
||||
const response = await getDoctorScheduleListByDeptIdAndDateRange(row.id, startDateStr, endDateStr)
|
||||
if (response.code === 200) {
|
||||
const actualData = response.data
|
||||
const deptSchedules = Array.isArray(actualData) ? actualData : (actualData && actualData.code === 200 ? actualData.data || [] : [])
|
||||
const deptSchedules = Array.isArray(actualData)
|
||||
? actualData
|
||||
: (actualData && actualData.code === 200 ? actualData.data || [] : [])
|
||||
const selectedRegType = filterParams.value.appointmentType === '专家' ? 1 : 0
|
||||
const filteredSchedules = deptSchedules.filter(schedule => Number(schedule.regType) === selectedRegType)
|
||||
|
||||
// 以 "具体日期-时段" 为 key 创建映射表,替代原来的 "星期-时段"
|
||||
// 同日期同时段可能存在多条排班,按 key 聚合成数组
|
||||
const scheduleMap = {}
|
||||
deptSchedules.forEach(schedule => {
|
||||
// scheduleDate 来自 adm_schedule_pool.schedule_date,是具体的出诊日期
|
||||
filteredSchedules.forEach(schedule => {
|
||||
const key = `${schedule.scheduleDate}-${schedule.timePeriod}`
|
||||
scheduleMap[key] = schedule
|
||||
})
|
||||
|
||||
// 将现有排班数据合并到周计划中(以具体日期匹配)
|
||||
weekSchedule.forEach(slot => {
|
||||
// slot.date 是前端生成的具体日期(yyyy-MM-dd),与后端的 scheduleDate 一致
|
||||
const key = `${slot.date}-${slot.timeSlot}`
|
||||
const existingSchedule = scheduleMap[key]
|
||||
|
||||
if (existingSchedule) {
|
||||
// 更新匹配的时段数据
|
||||
slot.doctorName = existingSchedule.doctor
|
||||
slot.doctorId = String(existingSchedule.doctorId) // 确保为字符串
|
||||
|
||||
// --- 容错逻辑:校验医生ID是否在当前医生列表中 ---
|
||||
const allAvailableDoctors = [...doctorOptions.value['普通'], ...doctorOptions.value['专家']];
|
||||
const matchedDoctorById = allAvailableDoctors.find(doc => doc.id === slot.doctorId);
|
||||
|
||||
if (!matchedDoctorById) {
|
||||
// 尝试根据医生姓名进行匹配
|
||||
const matchedDoctorByName = allAvailableDoctors.find(doc => doc.label === slot.doctorName);
|
||||
if (matchedDoctorByName) {
|
||||
slot.doctorId = matchedDoctorByName.id;
|
||||
console.warn(`【调试警告】排班记录doctorId ${existingSchedule.doctorId} (姓名: ${existingSchedule.doctor}) 与当前医生列表不匹配。已根据姓名修正为ID: ${matchedDoctorByName.id}`);
|
||||
} else {
|
||||
slot.doctorId = null;
|
||||
slot.doctorName = '';
|
||||
console.error(`【调试错误】排班记录doctorId ${existingSchedule.doctorId} 和医生姓名 "${existingSchedule.doctor}" 都未在当前医生列表中找到。`);
|
||||
}
|
||||
}
|
||||
// --- 结束容错逻辑 ---
|
||||
|
||||
slot.room = existingSchedule.clinic
|
||||
slot.startTime = existingSchedule.startTime
|
||||
slot.endTime = existingSchedule.endTime
|
||||
slot.maxNumber = existingSchedule.limitNumber
|
||||
slot.appointmentItem = existingSchedule.registerItem
|
||||
slot.registrationFee = existingSchedule.registerFee
|
||||
slot.clinicItem = existingSchedule.diagnosisItem
|
||||
slot.treatmentFee = existingSchedule.diagnosisFee
|
||||
slot.online = existingSchedule.isOnline
|
||||
slot.stopClinic = existingSchedule.isStopped
|
||||
slot.stopReason = existingSchedule.stopReason
|
||||
slot.backendId = existingSchedule.id // 保存后端ID
|
||||
if (!scheduleMap[key]) {
|
||||
scheduleMap[key] = []
|
||||
}
|
||||
scheduleMap[key].push(schedule)
|
||||
})
|
||||
|
||||
const allAvailableDoctors = [...doctorOptions.value['普通'], ...doctorOptions.value['专家']]
|
||||
const mergedSchedule = []
|
||||
|
||||
const applyScheduleToSlot = (targetSlot, existingSchedule) => {
|
||||
targetSlot.doctorName = existingSchedule.doctorName || existingSchedule.doctor || ''
|
||||
targetSlot.doctorId = existingSchedule.doctorId != null ? String(existingSchedule.doctorId) : null
|
||||
|
||||
const matchedDoctorById = allAvailableDoctors.find(doc => doc.id === targetSlot.doctorId)
|
||||
if (!matchedDoctorById && targetSlot.doctorName) {
|
||||
const matchedDoctorByName = allAvailableDoctors.find(doc => doc.label === targetSlot.doctorName)
|
||||
if (matchedDoctorByName) {
|
||||
targetSlot.doctorId = matchedDoctorByName.id
|
||||
}
|
||||
}
|
||||
|
||||
targetSlot.room = existingSchedule.clinic || existingSchedule.clinicRoom || ''
|
||||
targetSlot.startTime = existingSchedule.startTime
|
||||
targetSlot.endTime = existingSchedule.endTime
|
||||
targetSlot.maxNumber = existingSchedule.limitNumber
|
||||
targetSlot.appointmentItem = existingSchedule.registerItem
|
||||
targetSlot.registrationFee = existingSchedule.registerFee
|
||||
targetSlot.clinicItem = existingSchedule.diagnosisItem
|
||||
targetSlot.treatmentFee = existingSchedule.diagnosisFee
|
||||
targetSlot.online = existingSchedule.isOnline
|
||||
targetSlot.stopClinic = existingSchedule.isStopped
|
||||
targetSlot.stopReason = existingSchedule.stopReason
|
||||
targetSlot.regType = existingSchedule.regType
|
||||
targetSlot.backendId = existingSchedule.id
|
||||
}
|
||||
|
||||
weekSchedule.forEach(slot => {
|
||||
const key = `${slot.date}-${slot.timeSlot}`
|
||||
const existingSchedules = scheduleMap[key] || []
|
||||
|
||||
if (existingSchedules.length === 0) {
|
||||
mergedSchedule.push(slot)
|
||||
return
|
||||
}
|
||||
|
||||
existingSchedules.forEach((existingSchedule, index) => {
|
||||
const targetSlot = index === 0
|
||||
? slot
|
||||
: {
|
||||
...slot,
|
||||
id: `${slot.id}-dup-${existingSchedule.id || index}`,
|
||||
doctorName: '',
|
||||
doctorId: null,
|
||||
room: '',
|
||||
maxNumber: '',
|
||||
appointmentItem: '',
|
||||
registrationFee: 0,
|
||||
clinicItem: '',
|
||||
treatmentFee: 0,
|
||||
online: true,
|
||||
stopClinic: false,
|
||||
stopReason: ''
|
||||
}
|
||||
applyScheduleToSlot(targetSlot, existingSchedule)
|
||||
mergedSchedule.push(targetSlot)
|
||||
})
|
||||
})
|
||||
|
||||
scheduleList.value = mergedSchedule
|
||||
return
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取科室排班数据失败:', error)
|
||||
ElMessage.error('获取科室排班数据失败')
|
||||
}
|
||||
|
||||
// 设置排班列表
|
||||
console.log("【调试信息】即将渲染的排班数据:", JSON.parse(JSON.stringify(weekSchedule.filter(s => s.doctorId))));
|
||||
scheduleList.value = weekSchedule
|
||||
}
|
||||
|
||||
// 编辑
|
||||
const handleEdit = async (row) => {
|
||||
// 设置当前科室和模式
|
||||
currentDept.value = row
|
||||
@@ -1101,7 +1105,7 @@ const handleEdit = async (row) => {
|
||||
scheduleDialogTitle.value = `编辑科室排班 - ${row.name || row.deptName}`
|
||||
|
||||
// 动态设置筛选参数
|
||||
filterParams.value.orgName = row.orgName || '中联医院'
|
||||
filterParams.value.orgName = row.orgName || row.organizationName || row.org || ''
|
||||
filterParams.value.deptName = row.name || row.deptName
|
||||
|
||||
// 首先获取科室工作时间配置
|
||||
@@ -1152,7 +1156,7 @@ const handleView = async (row) => {
|
||||
scheduleDialogTitle.value = `查看科室排班 - ${row.name || row.deptName}`
|
||||
|
||||
// 动态设置筛选参数
|
||||
filterParams.value.orgName = row.orgName || '中联医院'
|
||||
filterParams.value.orgName = row.orgName || row.organizationName || row.org || ''
|
||||
filterParams.value.deptName = row.name || row.deptName
|
||||
|
||||
// 首先获取科室工作时间配置
|
||||
@@ -1249,20 +1253,14 @@ const searchClinicRooms = async (query) => {
|
||||
const doctorMapping = {}
|
||||
|
||||
// 排班类型变化处理
|
||||
const handleAppointmentTypeChange = () => {
|
||||
// 当排班类型改变时,自动匹配对应的医生
|
||||
const handleAppointmentTypeChange = async () => {
|
||||
if (currentDept.value) {
|
||||
await reloadScheduleData()
|
||||
return
|
||||
}
|
||||
scheduleList.value.forEach(item => {
|
||||
if (item.doctorName) {
|
||||
// 获取新类型对应的医生列表
|
||||
const newTypeDoctors = getDoctorOptions(filterParams.value.appointmentType)
|
||||
// 检查当前医生是否在新类型列表中
|
||||
const doctorExists = newTypeDoctors.some(doctor => doctor.value === item.doctorName)
|
||||
|
||||
if (!doctorExists) {
|
||||
// 如果当前医生不在新类型列表中,则清空
|
||||
item.doctorName = ''
|
||||
}
|
||||
}
|
||||
item.doctorId = null
|
||||
item.doctorName = ''
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1302,14 +1300,84 @@ const handleDoctorChange = (selectedId, row) => {
|
||||
row.doctorName = '';
|
||||
return;
|
||||
}
|
||||
const allDoctors = [...doctorOptions.value['普通'], ...doctorOptions.value['专家']];
|
||||
const selectedDoctor = allDoctors.find(doc => doc.id === String(selectedId));
|
||||
const typeDoctors = getDoctorOptions(filterParams.value.appointmentType)
|
||||
const selectedDoctor = typeDoctors.find(doc => doc.id === String(selectedId));
|
||||
if (selectedDoctor) {
|
||||
row.doctorName = selectedDoctor.label;
|
||||
}
|
||||
}
|
||||
|
||||
const resolveDoctorName = (row) => {
|
||||
if (row.doctorName && row.doctorName.trim() !== '') {
|
||||
return row.doctorName.trim()
|
||||
}
|
||||
if (!row.doctorId) {
|
||||
return ''
|
||||
}
|
||||
const allDoctors = [...doctorOptions.value['普通'], ...doctorOptions.value['专家']]
|
||||
const matched = allDoctors.find(doc => doc.id === String(row.doctorId))
|
||||
return matched ? matched.label : ''
|
||||
}
|
||||
|
||||
// 添加排班
|
||||
// 删除后兜底:当某天某时段被删空时,补一条重置行,保证可继续填写
|
||||
const createResetScheduleRow = (row) => {
|
||||
const regTypeValue = Number(row.regType)
|
||||
return {
|
||||
id: `reset-${Date.now()}-${Math.random()}`,
|
||||
date: row.date,
|
||||
weekday: row.weekday,
|
||||
timeSlot: row.timeSlot,
|
||||
startTime: row.startTime || '08:00',
|
||||
endTime: row.endTime || '12:00',
|
||||
doctorName: '',
|
||||
doctorId: null,
|
||||
room: '',
|
||||
maxNumber: '',
|
||||
appointmentItem: '',
|
||||
registrationFee: 0,
|
||||
clinicItem: '',
|
||||
treatmentFee: 0,
|
||||
online: true,
|
||||
stopClinic: false,
|
||||
stopReason: '',
|
||||
regType: Number.isNaN(regTypeValue) ? 0 : regTypeValue,
|
||||
isNew: true
|
||||
}
|
||||
}
|
||||
|
||||
const ensureResetRowAfterDelete = (row, insertIndex) => {
|
||||
const hasSameSlot = scheduleList.value.some(item =>
|
||||
item.date === row.date && item.timeSlot === row.timeSlot
|
||||
)
|
||||
if (hasSameSlot) {
|
||||
return
|
||||
}
|
||||
|
||||
const resetRow = createResetScheduleRow(row)
|
||||
if (insertIndex >= 0 && insertIndex <= scheduleList.value.length) {
|
||||
scheduleList.value.splice(insertIndex, 0, resetRow)
|
||||
return
|
||||
}
|
||||
scheduleList.value.push(resetRow)
|
||||
}
|
||||
|
||||
const isDraftScheduleRow = (row) => {
|
||||
return !row.backendId || row.isNew
|
||||
}
|
||||
|
||||
const isLastDraftRowInSlot = (row) => {
|
||||
if (!isDraftScheduleRow(row)) {
|
||||
return false
|
||||
}
|
||||
|
||||
const sameSlotRows = scheduleList.value.filter(item =>
|
||||
item.date === row.date && item.timeSlot === row.timeSlot
|
||||
)
|
||||
const draftRows = sameSlotRows.filter(item => isDraftScheduleRow(item))
|
||||
return draftRows.length <= 1
|
||||
}
|
||||
|
||||
const handleAddSchedule = (row) => {
|
||||
// 创建新的排班记录,基于当前行的日期和时段
|
||||
const newSchedule = {
|
||||
@@ -1346,6 +1414,11 @@ const handleAddSchedule = (row) => {
|
||||
|
||||
// 删除排班
|
||||
const handleDeleteSchedule = (row) => {
|
||||
if (isLastDraftRowInSlot(row)) {
|
||||
ElMessage.warning('当前时段需保留最后一条待填写记录,不能删除')
|
||||
return
|
||||
}
|
||||
|
||||
ElMessageBox.confirm('确定要删除这条排班记录吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
@@ -1354,15 +1427,17 @@ const handleDeleteSchedule = (row) => {
|
||||
// 如果是已保存的记录(有后端ID),调用删除接口
|
||||
if (row.backendId && !row.isNew) {
|
||||
deleteDoctorSchedule(row.backendId).then(res => {
|
||||
if (res.code === 200) {
|
||||
const removed = res?.data?.data === true || res?.data === true
|
||||
if (res.code === 200 && removed) {
|
||||
// 从列表中移除
|
||||
const index = scheduleList.value.findIndex(item => item.id === row.id)
|
||||
if (index !== -1) {
|
||||
scheduleList.value.splice(index, 1)
|
||||
ensureResetRowAfterDelete(row, index)
|
||||
}
|
||||
ElMessage.success('删除成功')
|
||||
} else {
|
||||
ElMessage.error(res.msg || '删除失败')
|
||||
ElMessage.error(res.msg || '删除失败,记录可能未真正删除')
|
||||
}
|
||||
}).catch(error => {
|
||||
console.error('删除排班失败:', error)
|
||||
@@ -1373,6 +1448,7 @@ const handleDeleteSchedule = (row) => {
|
||||
const index = scheduleList.value.findIndex(item => item.id === row.id)
|
||||
if (index !== -1) {
|
||||
scheduleList.value.splice(index, 1)
|
||||
ensureResetRowAfterDelete(row, index)
|
||||
ElMessage.success('删除成功')
|
||||
}
|
||||
}
|
||||
@@ -1445,7 +1521,7 @@ const handleEditSchedule = (row) => {
|
||||
}
|
||||
|
||||
// 设置科室信息
|
||||
filterParams.value.orgName = '中联医院' // 假设固定机构名称
|
||||
filterParams.value.orgName = currentDept.value?.orgName || currentDept.value?.organizationName || currentDept.value?.org || ''
|
||||
filterParams.value.deptName = '未知科室' // 这里可能需要根据实际情况设置
|
||||
|
||||
// 设置排班列表
|
||||
@@ -1505,12 +1581,12 @@ const handleSave = async () => {
|
||||
try {
|
||||
// 验证必填字段 - 只验证用户真正填写了信息的记录
|
||||
const filledSchedules = scheduleList.value.filter(item => {
|
||||
// 只有当用户为某一行选择了医生,我们才认为他打算保存此条记录
|
||||
return item.doctorName && item.doctorName.trim() !== '';
|
||||
// 已有排班可能只有 doctorId,没有 doctorName,二者任一存在都视为可保存记录
|
||||
return !!resolveDoctorName(item) || !!item.doctorId;
|
||||
});
|
||||
|
||||
const incompleteSchedules = filledSchedules.filter(item => {
|
||||
const isDoctorValid = item.doctorName && item.doctorName.trim() !== '';
|
||||
const isDoctorValid = !!resolveDoctorName(item) || !!item.doctorId;
|
||||
const isRoomValid = item.room && item.room.trim() !== '';
|
||||
const isStartTimeValid = item.startTime && typeof item.startTime === 'string';
|
||||
const isEndTimeValid = item.endTime && typeof item.endTime === 'string';
|
||||
@@ -1526,10 +1602,13 @@ const handleSave = async () => {
|
||||
|
||||
// 转换数据格式
|
||||
const schedulesToProcess = filledSchedules.map(item => {
|
||||
const regTypeValue = Number(
|
||||
item.regType ?? (filterParams.value.appointmentType === '专家' ? 1 : 0)
|
||||
);
|
||||
const scheduleData = {
|
||||
weekday: item.weekday,
|
||||
timePeriod: item.timeSlot,
|
||||
doctor: item.doctorName,
|
||||
doctor: resolveDoctorName(item),
|
||||
doctorId: item.doctorId,
|
||||
clinic: item.room,
|
||||
startTime: item.startTime,
|
||||
@@ -1543,6 +1622,7 @@ const handleSave = async () => {
|
||||
isStopped: item.stopClinic,
|
||||
stopReason: item.stopClinic ? (item.stopReason || '') : '',
|
||||
deptId: currentDept.value?.id || null,
|
||||
regType: Number.isNaN(regTypeValue) ? 0 : regTypeValue,
|
||||
scheduledDate: item.date // 添加具体日期字段
|
||||
};
|
||||
if (item.backendId) {
|
||||
@@ -2002,4 +2082,4 @@ onMounted(async () => {
|
||||
:deep(.el-dialog__body) {
|
||||
padding: 20px;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user