Fix Bug #491: 【执行科室配置】保存配置时系统报错
后端修复:时间冲突校验时 organizationService.getById 可能返回 null,增加空值判断避免 NPE 前端修复:保存前校验是否已选择科室,未选择时给出提示并阻断 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -147,8 +147,8 @@ public class OrganizationLocationAppServiceImpl implements IOrganizationLocation
|
|||||||
for (OrganizationLocation organizationLocation : organizationLocationList)
|
for (OrganizationLocation organizationLocation : organizationLocationList)
|
||||||
if (DateTimeUtils.isOverlap(organizationLocation.getStartTime(), organizationLocation.getEndTime(),
|
if (DateTimeUtils.isOverlap(organizationLocation.getStartTime(), organizationLocation.getEndTime(),
|
||||||
orgLoc.getStartTime(), orgLoc.getEndTime())) {
|
orgLoc.getStartTime(), orgLoc.getEndTime())) {
|
||||||
String organizationName =
|
Organization org = organizationService.getById(organizationLocation.getOrganizationId());
|
||||||
organizationService.getById(organizationLocation.getOrganizationId()).getName();
|
String organizationName = org != null ? org.getName() : "未知科室";
|
||||||
return R.fail("当前诊疗:" + activityName + CommonConstants.Common.DASH + orgLoc.getStartTime()
|
return R.fail("当前诊疗:" + activityName + CommonConstants.Common.DASH + orgLoc.getStartTime()
|
||||||
+ CommonConstants.Common.DASH + orgLoc.getEndTime() + "与" + organizationName + "时间冲突");
|
+ CommonConstants.Common.DASH + orgLoc.getEndTime() + "与" + organizationName + "时间冲突");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -132,6 +132,10 @@ function onCancel() {
|
|||||||
|
|
||||||
// 批量添加
|
// 批量添加
|
||||||
async function onConfirm() {
|
async function onConfirm() {
|
||||||
|
if (!props.organizationId) {
|
||||||
|
proxy.$message.error('请先在左侧选择科室');
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!formEl) return;
|
if (!formEl) return;
|
||||||
formEl.value.validate(async (valid) => {
|
formEl.value.validate(async (valid) => {
|
||||||
if (!valid) return;
|
if (!valid) return;
|
||||||
|
|||||||
@@ -366,6 +366,10 @@ function handleBlur(row, index) {
|
|||||||
|
|
||||||
// 编辑或 保存当前行
|
// 编辑或 保存当前行
|
||||||
function openSaveImplementDepartment(row) {
|
function openSaveImplementDepartment(row) {
|
||||||
|
if (!organizationId.value) {
|
||||||
|
proxy.$message.error('请先在左侧选择科室');
|
||||||
|
return;
|
||||||
|
}
|
||||||
const params = {
|
const params = {
|
||||||
// 科室id
|
// 科室id
|
||||||
organizationId: organizationId.value,
|
organizationId: organizationId.value,
|
||||||
@@ -452,13 +456,12 @@ function handleNodeClick(res, node) {
|
|||||||
|
|
||||||
// 实际的节点点击处理逻辑
|
// 实际的节点点击处理逻辑
|
||||||
function continueHandleNodeClick(node) {
|
function continueHandleNodeClick(node) {
|
||||||
// 新增按钮是否 disable
|
|
||||||
isAddDisable.value = false;
|
|
||||||
// 检查节点是否有子节点
|
// 检查节点是否有子节点
|
||||||
if (node.data.children && node.data.children.length > 0) {
|
if (node.data.children && node.data.children.length > 0) {
|
||||||
// proxy.$message.warning("不能选择父节点");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// 新增按钮是否 disable
|
||||||
|
isAddDisable.value = false;
|
||||||
// 选中科室id
|
// 选中科室id
|
||||||
organizationId.value = node.data.id;
|
organizationId.value = node.data.id;
|
||||||
// 获取 右侧 table 信息
|
// 获取 右侧 table 信息
|
||||||
|
|||||||
Reference in New Issue
Block a user