门诊号码管理维护界面-》优化

This commit is contained in:
2025-11-11 13:57:34 +08:00
parent c086dc8c77
commit 1711e6c115
5 changed files with 212 additions and 27 deletions

View File

@@ -0,0 +1,23 @@
/*
* Copyright ©2023 CJB-CNIT Team. All rights reserved
*/
package com.openhis.web.businessrule.appservice;
import com.openhis.web.businessrule.dto.OutpatientNoLogDto;
/**
* 门诊号码管理服务接口
*
* @author system
* @date 2025-01-XX
*/
public interface IOutpatientNoAppService {
/**
* 记录操作日志
*
* @param logDto 日志数据
*/
void addOperationLog(OutpatientNoLogDto logDto);
}

View File

@@ -0,0 +1,46 @@
/*
* Copyright ©2023 CJB-CNIT Team. All rights reserved
*/
package com.openhis.web.businessrule.appservice.impl;
import org.springframework.stereotype.Service;
import com.openhis.web.businessrule.appservice.IOutpatientNoAppService;
import com.openhis.web.businessrule.dto.OutpatientNoLogDto;
import lombok.extern.slf4j.Slf4j;
/**
* 门诊号码管理服务实现
*
* @author system
* @date 2025-01-XX
*/
@Service
@Slf4j
public class OutpatientNoAppServiceImpl implements IOutpatientNoAppService {
/**
* 记录操作日志
*
* @param logDto 日志数据
*/
@Override
public void addOperationLog(OutpatientNoLogDto logDto) {
// 记录日志到系统日志
log.info("门诊号码管理操作日志 - 操作类型: {}, 操作详情: {}, 操作结果: {}, 用户: {} (ID: {})",
logDto.getOperation(),
logDto.getDetails(),
logDto.getSuccess() ? "成功" : "失败",
logDto.getUserName(),
logDto.getUserId());
if (logDto.getErrorMessage() != null && !logDto.getErrorMessage().isEmpty()) {
log.warn("操作失败原因: {}", logDto.getErrorMessage());
}
// TODO: 如果需要保存到数据库,可以在这里添加数据库操作
// 例如:保存到 sys_oper_log 表或其他日志表
}
}

View File

@@ -0,0 +1,50 @@
/*
* Copyright ©2023 CJB-CNIT Team. All rights reserved
*/
package com.openhis.web.businessrule.controller;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.core.common.core.domain.R;
import com.openhis.web.businessrule.appservice.IOutpatientNoAppService;
import com.openhis.web.businessrule.dto.OutpatientNoLogDto;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
/**
* 门诊号码管理 controller
*
* @author system
* @date 2025-01-XX
*/
@RestController
@RequestMapping("/business-rule/outpatient-no")
@Slf4j
@AllArgsConstructor
public class OutpatientNoController {
@Autowired
private IOutpatientNoAppService outpatientNoAppService;
/**
* 记录操作日志
*
* @param logDto 日志数据
* @return 结果
*/
@PostMapping("/log")
public R<?> addOperationLog(@RequestBody OutpatientNoLogDto logDto) {
try {
outpatientNoAppService.addOperationLog(logDto);
return R.ok("操作日志记录成功");
} catch (Exception e) {
log.error("记录操作日志失败", e);
return R.fail("操作日志记录失败:" + e.getMessage());
}
}
}

View File

@@ -0,0 +1,40 @@
/*
* Copyright ©2023 CJB-CNIT Team. All rights reserved
*/
package com.openhis.web.businessrule.dto;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* 门诊号码操作日志DTO
*
* @author system
* @date 2025-01-XX
*/
@Data
@Accessors(chain = true)
public class OutpatientNoLogDto {
/** 操作类型(新增/修改/删除/查询) */
private String operation;
/** 操作详情 */
private String details;
/** 操作是否成功 */
private Boolean success;
/** 错误信息 */
private String errorMessage;
/** 时间戳 */
private String timestamp;
/** 用户ID */
private Long userId;
/** 用户名称 */
private String userName;
}

View File

@@ -1,5 +1,5 @@
<template> <template>
<!-- Windows XP风格窗口布局600px固定宽度 --> <!-- 全屏布局 -->
<div class="outpatient-no-management-wrapper"> <div class="outpatient-no-management-wrapper">
<div class="outpatient-no-management"> <div class="outpatient-no-management">
<!--标题栏32px高 --> <!--标题栏32px高 -->
@@ -33,18 +33,28 @@
</el-row> </el-row>
</div> </div>
<!-- 表格内容区自适应剩余高度 --> <!-- 表格内容区自适应剩余高度全屏显示 -->
<div class="table-content"> <div class="table-content">
<el-table <el-table
v-loading="loading" v-loading="loading"
:data="tableData" :data="tableData"
@selection-change="handleSelectionChange" @selection-change="handleSelectionChange"
:row-class-name="tableRowClassName" :row-class-name="tableRowClassName"
style="width: 100%;"
> >
<el-table-column type="selection" width="50" align="center" /> <el-table-column type="selection" width="50" align="center" />
<el-table-column label="序号" type="index" width="60" align="center" /> <el-table-column label="序号" type="index" width="60" align="center" />
<el-table-column label="操作员" prop="operatorName" min-width="120" /> <el-table-column label="操作员" prop="operatorName" min-width="120" />
<el-table-column label="员工工号" prop="staffNo" min-width="120" /> <el-table-column label="员工工号" prop="staffNo" min-width="120">
<template #default="{ row }">
<el-input
v-if="row._editing"
v-model.trim="row.staffNo"
placeholder="请输入员工工号"
/>
<span v-else>{{ row.staffNo }}</span>
</template>
</el-table-column>
<el-table-column label="领用日期" prop="receiveDate" min-width="140"> <el-table-column label="领用日期" prop="receiveDate" min-width="140">
<template #default="{ row }"> <template #default="{ row }">
<el-date-picker <el-date-picker
@@ -113,7 +123,7 @@
<el-input v-model="editForm.operatorName" disabled /> <el-input v-model="editForm.operatorName" disabled />
</el-form-item> </el-form-item>
<el-form-item label="员工工号"> <el-form-item label="员工工号">
<el-input v-model="editForm.staffNo" disabled /> <el-input v-model.trim="editForm.staffNo" placeholder="请输入员工工号" />
</el-form-item> </el-form-item>
<el-form-item label="领用日期"> <el-form-item label="领用日期">
<el-date-picker v-model="editForm.receiveDate" type="date" value-format="YYYY-MM-DD" style="width: 100%" /> <el-date-picker v-model="editForm.receiveDate" type="date" value-format="YYYY-MM-DD" style="width: 100%" />
@@ -174,11 +184,12 @@ const data = reactive({
queryParams: { queryParams: {
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
onlySelf: true, onlySelf: true, // 默认只查询当前账号下的记录
}, },
}) })
const { queryParams } = toRefs(data) const { queryParams } = toRefs(data)
// 初始化配置并自动获取当前账号下的所有号码段记录
initConfig() initConfig()
getList() getList()
@@ -207,11 +218,13 @@ function onAdd() {
const yyyy = now.getFullYear() const yyyy = now.getFullYear()
const mm = String(now.getMonth() + 1).padStart(2, '0') const mm = String(now.getMonth() + 1).padStart(2, '0')
const dd = String(now.getDate()).padStart(2, '0') const dd = String(now.getDate()).padStart(2, '0')
// 员工工号默认为当前用户ID文本格式
const defaultStaffNo = String(userStore.id || '')
tableData.value.push({ tableData.value.push({
id: undefined, id: undefined,
operatorId: userStore.id, operatorId: userStore.id,
operatorName: userStore.name || userStore.nickName, operatorName: userStore.name || userStore.nickName,
staffNo: userStore.id, staffNo: defaultStaffNo, // 默认取当前员工工号用户ID
receiveDate: `${yyyy}-${mm}-${dd}`, receiveDate: `${yyyy}-${mm}-${dd}`,
startNo: '', startNo: '',
endNo: '', endNo: '',
@@ -244,7 +257,8 @@ function openEdit(row, index) {
editForm.endNo = row.endNo editForm.endNo = row.endNo
editForm.usedNo = row.usedNo editForm.usedNo = row.usedNo
editForm.operatorName = row.operatorName editForm.operatorName = row.operatorName
editForm.staffNo = row.staffNo // 员工工号可编辑如果为空则默认取当前用户ID
editForm.staffNo = row.staffNo || String(userStore.id || '')
dialogVisible.value = true dialogVisible.value = true
} }
@@ -489,8 +503,10 @@ function onDelete() {
} }
} }
// 打开界面系统自动获取当前账号下维护的所有号码段记录
function getList() { function getList() {
loading.value = true loading.value = true
// 默认只查询当前账号下的记录onlySelf = true
queryParams.value.onlySelf = !viewAll.value queryParams.value.onlySelf = !viewAll.value
const res = lcList({ ...queryParams.value }) const res = lcList({ ...queryParams.value })
tableData.value = res.records.map((it) => ({ tableData.value = res.records.map((it) => ({
@@ -498,6 +514,8 @@ function getList() {
_editing: false, _editing: false,
_error: false, _error: false,
_dirty: false, _dirty: false,
// 确保员工工号为文本格式
staffNo: it.staffNo ? String(it.staffNo) : String(userStore.id || ''),
})) }))
total.value = res.total total.value = res.total
loading.value = false loading.value = false
@@ -576,27 +594,30 @@ function lcDeleteByIds(idList) {
</script> </script>
<style scoped> <style scoped>
/*Windows XP风格布局 */ /* 全屏布局 */
/* 外层容器 - 居中显示 */ /* 外层容器 - 全屏显示 */
.outpatient-no-management-wrapper { .outpatient-no-management-wrapper {
display: flex; width: 100%;
justify-content: center; height: 100%;
align-items: flex-start; min-height: calc(100vh - 84px);
min-height: calc(100vh - 100px); padding: 0;
padding: 20px;
background-color: #f0f0f0; background-color: #f0f0f0;
display: flex;
flex-direction: column;
} }
/* 主容器 - 600px固定宽度 */ /* 主容器 - 全屏宽度 */
.outpatient-no-management { .outpatient-no-management {
width: 600px; width: 100%;
height: 100%;
background-color: #D4D0C8; background-color: #D4D0C8;
border: 1px solid #000000; border: 1px solid #000000;
box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.3); box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.3);
display: flex; display: flex;
flex-direction: column; flex-direction: column;
min-height: 500px; flex: 1;
min-height: calc(100vh - 84px);
} }
/* 标题栏32px高背景色#D4D0C8 */ /* 标题栏32px高背景色#D4D0C8 */
@@ -697,19 +718,29 @@ function lcDeleteByIds(idList) {
cursor: not-allowed; cursor: not-allowed;
} }
/*表格内容区(自适应剩余高度) */ /*表格内容区(自适应剩余高度,全屏显示 */
.table-content { .table-content {
flex: 1; flex: 1;
background-color: #FFFFFF; background-color: #FFFFFF;
padding: 8px; padding: 8px;
overflow: auto; overflow: hidden;
min-height: 400px; min-height: 0;
display: flex;
flex-direction: column;
} }
/* 表格样式1px实线边框#CCCCCC表头背景#F0F0F0 */ /* 表格样式1px实线边框#CCCCCC表头背景#F0F0F0 */
.table-content :deep(.el-table) { .table-content :deep(.el-table) {
border: 1px solid #CCCCCC; border: 1px solid #CCCCCC;
font-size: 13px; font-size: 13px;
height: 100%;
display: flex;
flex-direction: column;
}
.table-content :deep(.el-table__body-wrapper) {
flex: 1;
overflow-y: auto;
} }
.table-content :deep(.el-table th) { .table-content :deep(.el-table th) {
@@ -807,14 +838,9 @@ function lcDeleteByIds(idList) {
} }
/* 响应式调整 */ /* 响应式调整 */
@media (max-width: 650px) { @media (max-width: 768px) {
.outpatient-no-management { .outpatient-no-management {
width: 100%; min-height: calc(100vh - 84px);
min-height: 100vh;
}
.outpatient-no-management-wrapper {
padding: 0;
} }
} }
</style> </style>