Merge remote-tracking branch 'origin/develop' into develop
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>
|
||||
|
||||
@@ -135,6 +135,10 @@
|
||||
<el-input v-model="formData.provisionalDiagnosis" type="textarea" :rows="2" disabled />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="会诊确认参加医师">
|
||||
<el-input v-model="formData.confirmingPhysician" type="textarea" disabled />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="会诊意见" required>
|
||||
<el-input
|
||||
v-model="formData.consultationOpinion"
|
||||
|
||||
@@ -0,0 +1,151 @@
|
||||
import request from '@/utils/request';
|
||||
|
||||
/**
|
||||
* 查询传染病报卡列表
|
||||
* @param {Object} params - 查询参数
|
||||
* @param {string} params.cardNo - 报卡编号
|
||||
* @param {string} params.patientName - 患者姓名
|
||||
* @param {string} params.status - 审核状态
|
||||
* @param {string} params.registrationSource - 登记来源
|
||||
* @param {string} params.deptId - 科室 ID
|
||||
* @param {string} params.startDate - 开始日期
|
||||
* @param {string} params.endDate - 结束日期
|
||||
* @param {number} params.pageNum - 页码
|
||||
* @param {number} params.pageSize - 每页数量
|
||||
*/
|
||||
export function listInfectiousCards(params) {
|
||||
return request({
|
||||
url: '/report-manage/infectiousDiseaseReport/list-page',
|
||||
method: 'get',
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询传染病报卡详情
|
||||
* @param {string} cardNo - 报卡编号
|
||||
*/
|
||||
export function getInfectiousCard(cardNo) {
|
||||
return request({
|
||||
url: `/report-manage/infectiousDiseaseReport/detail/${cardNo}`,
|
||||
method: 'get',
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存传染病报卡
|
||||
* @param {Object} data - 报卡数据
|
||||
*/
|
||||
export function saveInfectiousDiseaseReport(data) {
|
||||
return request({
|
||||
url: '/report-manage/infectiousDiseaseReport',
|
||||
method: 'post',
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改传染病报卡
|
||||
* @param {Object} data - 报卡数据
|
||||
*/
|
||||
export function updateInfectiousDiseaseReport(data) {
|
||||
return request({
|
||||
url: '/report-manage/infectiousDiseaseReport',
|
||||
method: 'put',
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除传染病报卡
|
||||
* @param {string} cardNo - 报卡编号
|
||||
*/
|
||||
export function deleteInfectiousCard(cardNo) {
|
||||
return request({
|
||||
url: `/report-manage/infectiousDiseaseReport/${cardNo}`,
|
||||
method: 'delete',
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 审核传染病报卡(功能暂未实现)
|
||||
* @param {Object} data - 审核数据
|
||||
* @param {string} data.cardNo - 报卡编号
|
||||
* @param {string} data.auditOpinion - 审核意见
|
||||
* @param {string} data.status - 审核状态(2:通过)
|
||||
*/
|
||||
// export function auditInfectiousCard(data) {
|
||||
// return request({
|
||||
// url: '/report-manage/infectiousDiseaseReport/audit',
|
||||
// method: 'post',
|
||||
// data,
|
||||
// });
|
||||
// }
|
||||
|
||||
/**
|
||||
* 退回传染病报卡(功能暂未实现)
|
||||
* @param {Object} data - 退回数据
|
||||
* @param {string} data.cardNo - 报卡编号
|
||||
* @param {string} data.returnReason - 退回原因
|
||||
* @param {string} data.status - 审核状态(5:审核失败)
|
||||
*/
|
||||
// export function returnInfectiousCard(data) {
|
||||
// return request({
|
||||
// url: '/report-manage/infectiousDiseaseReport/return',
|
||||
// method: 'post',
|
||||
// data,
|
||||
// });
|
||||
// }
|
||||
|
||||
/**
|
||||
* 批量审核传染病报卡(功能暂未实现)
|
||||
* @param {Object} data - 批量审核数据
|
||||
* @param {Array<string>} data.cardNos - 报卡编号数组
|
||||
* @param {string} data.auditOpinion - 审核意见
|
||||
* @param {string} data.status - 审核状态(2:通过)
|
||||
*/
|
||||
// export function batchAuditCards(data) {
|
||||
// return request({
|
||||
// url: '/report-manage/infectiousDiseaseReport/batchAudit',
|
||||
// method: 'post',
|
||||
// data,
|
||||
// });
|
||||
// }
|
||||
|
||||
/**
|
||||
* 批量退回传染病报卡(功能暂未实现)
|
||||
* @param {Object} data - 批量退回数据
|
||||
* @param {Array<string>} data.cardNos - 报卡编号数组
|
||||
* @param {string} data.returnReason - 退回原因
|
||||
* @param {string} data.status - 审核状态(5:审核失败)
|
||||
*/
|
||||
// export function batchReturnCards(data) {
|
||||
// return request({
|
||||
// url: '/report-manage/infectiousDiseaseReport/batchReturn',
|
||||
// method: 'post',
|
||||
// data,
|
||||
// });
|
||||
// }
|
||||
|
||||
/**
|
||||
* 获取科室树
|
||||
* @param {string} deptId - 科室 ID(可选)
|
||||
*/
|
||||
export function getDeptTree(deptId) {
|
||||
return request({
|
||||
url: '/report-manage/infectiousDiseaseReport/dept-tree',
|
||||
method: 'get',
|
||||
params: { deptId },
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询审核记录
|
||||
* @param {string} cardNo - 报卡编号
|
||||
*/
|
||||
export function getAuditRecords(cardNo) {
|
||||
return request({
|
||||
url: `/report-manage/infectiousDiseaseReport/auditRecords/${cardNo}`,
|
||||
method: 'get',
|
||||
});
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1314,7 +1314,7 @@ async function buildSubmitData() {
|
||||
reportDate: formData.reportDate || null,
|
||||
cardNameCode: 1, // 默认中华人民共和国传染病报告卡
|
||||
registrationSource: 1, // 默认门诊
|
||||
status: 0,
|
||||
status: '',
|
||||
deptId: props.deptId || null,
|
||||
doctorId: props.doctorId || null,
|
||||
};
|
||||
|
||||
@@ -242,21 +242,25 @@
|
||||
</template>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="检验类型" min-width="120" align="center">
|
||||
<el-table-column label="检验类型" min-width="120" align="center">
|
||||
<template #default="{ row }">
|
||||
<template v-if="editingRowId === row.id">
|
||||
<el-select v-model="row.inspectionTypeId" placeholder="选择检验类型" size="small" style="width: 100%;" @change="(val) => { const selected = testTypes.find(t => t.id === val); row.testType = selected ? selected.label : ''; }">
|
||||
<el-select v-model="row.inspectionTypeId" placeholder="选择检验类型" size="small" style="width: 100%;" filterable
|
||||
clearable
|
||||
@change="(val) => handleParentChange(val, row)">
|
||||
<el-option label="选择检验类型" value="" />
|
||||
<!-- 使用 name 作为显示,id 作为值 -->
|
||||
<el-option
|
||||
v-for="type in testTypes"
|
||||
:key="type.id"
|
||||
:label="type.label"
|
||||
:value="type.id"
|
||||
v-for="item in parentTypeOptions"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
/>
|
||||
|
||||
</el-select>
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ row.testType }}
|
||||
{{ row.testType || '-' }}
|
||||
</template>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -331,13 +335,32 @@
|
||||
<el-table-column label="下级医技类型" min-width="100" align="center">
|
||||
<template #default="{ row }">
|
||||
<template v-if="editingRowId === row.id">
|
||||
<el-input v-model="row.subType" size="small" />
|
||||
<el-select
|
||||
v-model="row.subItemId"
|
||||
placeholder="请先选大类"
|
||||
size="small"
|
||||
style="width: 100%"
|
||||
filterable
|
||||
clearable
|
||||
:disabled="!row.inspectionTypeId"
|
||||
:loading="row.loadingSubItems"
|
||||
@change="handleEditRow"
|
||||
>
|
||||
<!-- 数据源来自行内动态加载的 subItemOptions -->
|
||||
<el-option
|
||||
v-for="item in (row.subItemOptions || [])"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ row.sub医技Type || '-' }}
|
||||
{{ row.subItemName || '-' }}
|
||||
</template>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="备注" min-width="100" align="center">
|
||||
<template #default="{ row }">
|
||||
<template v-if="editingRowId === row.id">
|
||||
@@ -1041,6 +1064,121 @@ onMounted(() => {
|
||||
});
|
||||
|
||||
|
||||
// ==============================
|
||||
// 【修复】级联下拉框逻辑 (包含直接请求代码)
|
||||
// ==============================
|
||||
|
||||
// 1. 定义响应式数据
|
||||
const parentTypeOptions = ref([]);
|
||||
|
||||
// 2. 【核心】直接发送请求的方法
|
||||
// 这里直接使用 request 工具,不依赖外部 api 文件
|
||||
const fetchInspectionTypesRequest = (params) => {
|
||||
return request({
|
||||
url: '/system/inspection-type/list', // 你的后端接口地址
|
||||
method: 'get',
|
||||
params: params
|
||||
});
|
||||
};
|
||||
|
||||
// 3. 加载所有顶级大类
|
||||
const loadParentTypes = async () => {
|
||||
try {
|
||||
// 【发送请求】不传参数,获取所有数据
|
||||
const res = await fetchInspectionTypesRequest({});
|
||||
|
||||
let allData = [];
|
||||
// 兼容多种返回格式
|
||||
if (res.code === 200) {
|
||||
if(res.data && Array.isArray(res.data)) allData = res.data;
|
||||
else if(res.data && res.data.rows) allData = res.data.rows;
|
||||
else if(res.data && res.data.data && Array.isArray(res.data.data)) allData = res.data.data;
|
||||
}
|
||||
|
||||
// 过滤:只保留 parentId 为 null/undefined 的记录作为“大类”
|
||||
parentTypeOptions.value = allData.filter(item =>
|
||||
item.parentId === null || item.parentId === undefined || item.parentId === ''
|
||||
);
|
||||
} catch (error) {
|
||||
ElMessage.error('网络异常,加载大类失败');
|
||||
}
|
||||
};
|
||||
|
||||
// 4. 处理大类改变,联动加载子类
|
||||
const handleParentChange = async (selectedId, row) => {
|
||||
// A. 更新当前行的显示名称
|
||||
const selected = parentTypeOptions.value.find(t => t.id === selectedId);
|
||||
row.inspectionTypeName = selected ? selected.name : '';
|
||||
|
||||
// B. 【重要】重置下级数据
|
||||
row.subItemId = '';
|
||||
row.subItemName = '';
|
||||
row.subItemOptions = [];
|
||||
|
||||
if (!selectedId) return;
|
||||
|
||||
// C. 设置加载状态
|
||||
row.loadingSubItems = true;
|
||||
|
||||
try {
|
||||
// 【发送请求】传入 parentId 参数获取子类
|
||||
const res = await fetchInspectionTypesRequest({ parentId: selectedId });
|
||||
|
||||
let subData = [];
|
||||
if (res.code === 200) {
|
||||
if(res.data && Array.isArray(res.data)) subData = res.data;
|
||||
else if(res.data && res.data.rows) subData = res.data.rows;
|
||||
else if(res.data && res.data.data && Array.isArray(res.data.data)) subData = res.data.data;
|
||||
|
||||
row.subItemOptions = subData;
|
||||
|
||||
// 可选优化:如果子类只有一个,自动选中
|
||||
if (subData.length === 1) {
|
||||
row.subItemId = subData[0].id;
|
||||
row.subItemName = subData[0].name;
|
||||
}
|
||||
} else {
|
||||
ElMessage.info('该分类下暂无子项目');
|
||||
}
|
||||
} catch (error) {
|
||||
ElMessage.error('加载子项目失败');
|
||||
} finally {
|
||||
row.loadingSubItems = false;
|
||||
}
|
||||
};
|
||||
|
||||
// 5. 点击编辑按钮时触发
|
||||
const handleEditRow = (row) => {
|
||||
if (editingRowId.value && editingRowId.value !== row.id) {
|
||||
ElMessage.warning('请先保存或取消当前正在编辑的行');
|
||||
return;
|
||||
}
|
||||
|
||||
editingRowId.value = row.id;
|
||||
|
||||
// 初始化行内属性
|
||||
if (!row.subItemOptions) row.subItemOptions = [];
|
||||
row.loadingSubItems = false;
|
||||
|
||||
// 回显名称
|
||||
if (row.inspectionTypeId && !row.inspectionTypeName) {
|
||||
const p = parentTypeOptions.value.find(i => i.id === row.inspectionTypeId);
|
||||
if (p) row.inspectionTypeName = p.name;
|
||||
}
|
||||
|
||||
if (row.subItemId && row.subItemOptions.length > 0) {
|
||||
const s = row.subItemOptions.find(i => i.id === row.subItemId);
|
||||
if (s) row.subItemName = s.name;
|
||||
}
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
// ... 其他初始化代码
|
||||
loadParentTypes(); // <--- 确保这一行存在
|
||||
// ...
|
||||
});
|
||||
|
||||
|
||||
// 样本类型数据
|
||||
const sampleTypes = ref([
|
||||
{ value: '血液', label: '血液' },
|
||||
@@ -1154,7 +1292,7 @@ const loadObservationItems = async (resetPage = false) => {
|
||||
testType: item.inspectionTypeId_dictText || item.testType || '', // 优先使用字典翻译字段
|
||||
inspectionTypeId: item.inspectionTypeId || null, // 检验类型ID
|
||||
package: '',
|
||||
sampleType: item.specimenCode_dictText || '',
|
||||
sampleType: item.specimenCode || '',
|
||||
amount: parseFloat(item.retailPrice || 0),
|
||||
sortOrder: item.sortOrder || null,
|
||||
serviceRange: item.serviceRange || '全部',
|
||||
@@ -1782,7 +1920,7 @@ const saveItem = async (item) => {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!item.testType) {
|
||||
if (!item.inspectionTypeId) {
|
||||
ElMessage.error('检验类型不能为空');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
v-for="dept in departments"
|
||||
:key="dept.dictValue"
|
||||
:label="dept.dictLabel"
|
||||
:value="dept.dictLabel"
|
||||
:value="dept.deptCode || dept.busNoPrefix || dept.rawOrg?.busNo || dept.dictLabel"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
@@ -200,10 +200,57 @@ import {getDicts} from '@/api/system/dict/data'
|
||||
import {listDept} from '@/api/system/dept'
|
||||
import {delCheckPackage, getCheckPackage, listCheckPackage} from '@/api/system/checkType'
|
||||
import request from '@/utils/request'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
|
||||
// 定义emit事件
|
||||
const emit = defineEmits(['switch-to-settings'])
|
||||
|
||||
const userStore = useUserStore()
|
||||
|
||||
//删除
|
||||
function handleDelete(row) {
|
||||
const currentUser = userStore.name
|
||||
console.log('当前用户:', currentUser, '套餐创建者:', row.creator)
|
||||
//只有创建者本人才能删除(creator为空时不能删除)
|
||||
if(!row.creator){
|
||||
ElMessage.warning('该套餐创建者未知,无法删除')
|
||||
return
|
||||
}
|
||||
if(row.creator !== currentUser){
|
||||
ElMessage.warning(`该套餐由"${row.creator}"创建,您没有权限删除`)
|
||||
return
|
||||
}
|
||||
|
||||
ElMessageBox.confirm(
|
||||
`确认删除套餐ID:${row.id} - ${row.packageName} 吗?删除后将无法恢复`,
|
||||
'确认删除',
|
||||
{
|
||||
confirmButtonText:'确定删除',
|
||||
cancelButtonText:'取消',
|
||||
type: 'warning',
|
||||
buttonSize:'default'
|
||||
}
|
||||
).then(async () => {
|
||||
try{const response = await delCheckPackage(row.id)
|
||||
|
||||
if(response && response.code === 200 || response.code === 0){
|
||||
ElMessage.success('删除成功')
|
||||
handleQuery()
|
||||
}else{
|
||||
ElMessage.error(response?.msg || response?.message || '删除失败')
|
||||
}
|
||||
}catch(error){
|
||||
console.error('删除失败:',error)
|
||||
const errorMsg = error?.response?.data?.msg || error?.message || ''
|
||||
if(errorMsg.includes('foreign key') || errorMsg.includes('violates foreign key')){
|
||||
ElMessage.warning('该套餐已被使用,无法删除')
|
||||
}else{
|
||||
ElMessage.error('删除失败:'+(error.message || '未知错误'))
|
||||
}
|
||||
}
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
||||
// 查询参数
|
||||
const queryParams = reactive({
|
||||
pageNo: 1,
|
||||
@@ -541,33 +588,7 @@ async function handleView(row) {
|
||||
}
|
||||
}
|
||||
|
||||
// 删除
|
||||
function handleDelete(row) {
|
||||
ElMessageBox.confirm(
|
||||
`确认删除套餐ID:${row.id} - ${row.packageName}吗?删除后将无法恢复!`,
|
||||
'删除确认',
|
||||
{
|
||||
confirmButtonText: '确定删除',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
buttonSize: 'default'
|
||||
}
|
||||
).then(async () => {
|
||||
try {
|
||||
const response = await delCheckPackage(row.id)
|
||||
|
||||
if (response && (response.code === 200 || response.code === 0)) {
|
||||
ElMessage.success('删除成功')
|
||||
handleQuery()
|
||||
} else {
|
||||
ElMessage.error(response?.msg || response?.message || '删除失败')
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('删除失败:', error)
|
||||
ElMessage.error('删除失败: ' + (error.message || '未知错误'))
|
||||
}
|
||||
}).catch(() => {})
|
||||
}
|
||||
// 查询参数
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
@@ -215,10 +215,13 @@
|
||||
:label="(item.name || item.itemName || '未命名') + (item.busNo ? ' [' + item.busNo + ']' : '')"
|
||||
:value="item.id"
|
||||
>
|
||||
<span style="float: left">{{ item.name || item.itemName }}</span>
|
||||
<span style="float: right; color: #8492a6; font-size: 13px">
|
||||
{{ item.busNo || item.code }}
|
||||
</span>
|
||||
<div style="display: flex; justify-content: space-between; align-items: center; width: 100%;">
|
||||
<span>{{ item.name || item.itemName }}</span>
|
||||
<span style="display: flex; align-items: center; gap: 8px;">
|
||||
<span style="color: #8492a6; font-size: 13px;">{{ item.busNo || item.code }}</span>
|
||||
<span style="color: #E6A23C; font-size: 13px; font-weight: 500;">¥{{ item.retailPrice || item.price || item.unitPrice || 0 }}</span>
|
||||
</span>
|
||||
</div>
|
||||
</el-option>
|
||||
<template #empty>
|
||||
<div style="padding: 10px; text-align: center; color: #999;">
|
||||
@@ -233,12 +236,6 @@
|
||||
</div>
|
||||
</template>
|
||||
</el-select>
|
||||
<div style="font-size: 12px; color: #999; margin-top: 4px;">
|
||||
共 {{ diagnosisTreatmentList.length }} 个可选项目
|
||||
<span v-if="row.filteredList && row.filteredList.length < diagnosisTreatmentList.length">
|
||||
(搜索结果: {{ row.filteredList.length }} 个)
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<span v-else>{{ row.itemName }}</span>
|
||||
</template>
|
||||
@@ -286,21 +283,21 @@
|
||||
:precision="0"
|
||||
placeholder="请输入数量"
|
||||
style="width: 100%"
|
||||
:controls="false"
|
||||
@change="calculateAmount(row)"
|
||||
/>
|
||||
<span v-else>{{ row.quantity }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="unitPrice" label="单价" width="120" align="center">
|
||||
<el-table-column prop="unitPrice" label="单价" width="150" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-input-number
|
||||
<el-input
|
||||
v-if="row.editing"
|
||||
v-model="row.unitPrice"
|
||||
:min="0"
|
||||
:precision="6"
|
||||
placeholder="请输入单价"
|
||||
placeholder="自动获取"
|
||||
style="width: 100%"
|
||||
@change="calculateAmount(row)"
|
||||
size="small"
|
||||
disabled
|
||||
/>
|
||||
<span v-else>{{ row.unitPrice?.toFixed(6) }}</span>
|
||||
</template>
|
||||
@@ -319,6 +316,7 @@
|
||||
:precision="2"
|
||||
placeholder="服务费"
|
||||
style="width: 100%"
|
||||
:controls="false"
|
||||
@change="calculateTotal(row)"
|
||||
/>
|
||||
<span v-else>{{ row.serviceCharge?.toFixed(2) || '0.00' }}</span>
|
||||
@@ -524,8 +522,8 @@ function loadPackageData(data) {
|
||||
})
|
||||
|
||||
// 填充明细数据
|
||||
if (data.details && Array.isArray(data.details)) {
|
||||
detailData.value = data.details.map(item => ({
|
||||
if (data.items && Array.isArray(data.items)) {
|
||||
detailData.value = data.items.map(item => ({
|
||||
code: item.itemCode || '',
|
||||
itemId: item.checkItemId,
|
||||
itemName: item.itemName || '',
|
||||
@@ -687,10 +685,13 @@ onMounted(async () => {
|
||||
}
|
||||
|
||||
// 加载诊疗项目列表(优先使用缓存)
|
||||
await loadDiagnosisTreatmentList(false)
|
||||
await loadDiagnosisTreatmentList(true)
|
||||
|
||||
// 初始化一行空数据
|
||||
handleAddRow()
|
||||
if(props.mode === 'add'){
|
||||
handleAddRow()
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error('✗ 初始化数据失败:', error)
|
||||
}
|
||||
@@ -824,6 +825,10 @@ function handlePackageLevelChange(value) {
|
||||
// 个人套餐,用户必填
|
||||
formRules.user = [{ required: true, message: '请选择用户', trigger: 'change' }]
|
||||
formRules.department = []
|
||||
// 自动获取当前登录账号名称赋值给用户选择字段
|
||||
if (!formData.user && userStore.name) {
|
||||
formData.user = userStore.name
|
||||
}
|
||||
} else {
|
||||
// 全院套餐,都不必填
|
||||
formRules.department = []
|
||||
@@ -936,8 +941,7 @@ function initializeSearchList(row) {
|
||||
|
||||
// 项目搜索处理(支持首字母和模糊搜索)
|
||||
function handleProjectSearch(query, row) {
|
||||
console.log('搜索关键字:', query)
|
||||
|
||||
|
||||
if (!query || query.trim() === '') {
|
||||
row.filteredList = diagnosisTreatmentList.value
|
||||
return
|
||||
@@ -1185,6 +1189,7 @@ async function handleSave() {
|
||||
|
||||
if (response && (response.code === 200 || response.code === 0)) {
|
||||
ElMessage.success('套餐数据已保存')
|
||||
emit('save-success')
|
||||
// 如果有返回ID,更新formData.id以便后续更新
|
||||
if (response.data && !formData.id) {
|
||||
formData.id = response.data
|
||||
|
||||
@@ -534,19 +534,19 @@
|
||||
{{ item.number || '999999' }}
|
||||
</template>
|
||||
</td>
|
||||
<td>
|
||||
<td>
|
||||
<template v-if="item.editing">
|
||||
<el-select v-model="item.checkType" placeholder="选择检查类型" style="width: 100%">
|
||||
<el-select v-model="item.serviceScope" placeholder="选择服务范围" style="width: 100%">
|
||||
<el-option
|
||||
v-for="opt in checkTypeOptionsForMethodPart"
|
||||
:key="opt.value"
|
||||
:label="opt.label"
|
||||
:value="opt.value"
|
||||
v-for="opt in serviceScopeDicts"
|
||||
:key="opt.dictValue"
|
||||
:label="opt.dictLabel"
|
||||
:value="opt.dictValue"
|
||||
/>
|
||||
</el-select>
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ getCheckTypeLabelForMethodPart(item.checkType) || '无' }}
|
||||
{{ getServiceScopeLabel(item.serviceScope) || '无' }}
|
||||
</template>
|
||||
</td>
|
||||
<td>
|
||||
@@ -667,6 +667,8 @@ const checkTypeOptions = ref([]);
|
||||
const inspectionTypeDicts = ref([]);
|
||||
// 完整的服务范围字典数据
|
||||
const serviceScopeDicts = ref([]);
|
||||
// 服务范围下拉选项
|
||||
const serviceScopeOptions = ref([]);
|
||||
const checkMethods = ref([]);
|
||||
|
||||
// 根据字典值获取检查类型标签
|
||||
@@ -926,6 +928,11 @@ onMounted(async () => {
|
||||
inspectionTypeDicts.value = [];
|
||||
}
|
||||
|
||||
// 获取服务范围字典
|
||||
const scopeRes = await getDicts('scope_of_services');
|
||||
serviceScopeDicts.value = scopeRes?.data || [];
|
||||
|
||||
|
||||
// 从检查类型维护页面获取检查类型数据,用于检查方法和检查部位的下拉选项
|
||||
await loadCheckTypeOptionsForMethodPart();
|
||||
|
||||
@@ -1013,10 +1020,21 @@ function handleSwitchToSettings(params) {
|
||||
}
|
||||
|
||||
// 保存成功后保持在套餐设置界面
|
||||
function handleSaveSuccess() {
|
||||
async function handleSaveSuccess() {
|
||||
console.log('保存成功')
|
||||
// 保存成功后保持在套餐设置界面,可以继续编辑或返回管理界面
|
||||
ElMessage.success('保存成功')
|
||||
|
||||
// 刷新套餐列表数据
|
||||
try {
|
||||
const packageResponse = await listCheckPackage();
|
||||
if (packageResponse && packageResponse.data) {
|
||||
checkPackages.value = Array.isArray(packageResponse.data) ? packageResponse.data : [];
|
||||
filteredPackageOptions.value = checkPackages.value;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('刷新套餐列表失败:', error);
|
||||
}
|
||||
}
|
||||
|
||||
// 根据菜单加载对应数据
|
||||
|
||||
Reference in New Issue
Block a user