diff --git a/openhis-ui-vue3/src/views/basicmanage/outpatientNoManagement/components/operationLog.js b/openhis-ui-vue3/src/views/basicmanage/outpatientNoManagement/components/operationLog.js index c9ab9bbb..0f52ca97 100644 --- a/openhis-ui-vue3/src/views/basicmanage/outpatientNoManagement/components/operationLog.js +++ b/openhis-ui-vue3/src/views/basicmanage/outpatientNoManagement/components/operationLog.js @@ -28,12 +28,8 @@ export async function logOperation({ operation, details, success, errorMessage, // 控制台输出(便于调试) console.log('[门诊号码管理] 操作日志:', logData) - // 调用后端接口记录日志 - try { - await addOperationLog(logData) - } catch (apiError) { - console.warn('[门诊号码管理] 日志接口调用失败,仅记录到控制台') - } + // 调用后端接口记录日志(如果接口不存在,静默失败,不会抛出异常) + await addOperationLog(logData) } catch (error) { console.error('[门诊号码管理] 记录日志失败:', error) } diff --git a/openhis-ui-vue3/src/views/basicmanage/outpatientNoManagement/components/outpatientNumber.js b/openhis-ui-vue3/src/views/basicmanage/outpatientNoManagement/components/outpatientNumber.js index a7e3e259..0def65db 100644 --- a/openhis-ui-vue3/src/views/basicmanage/outpatientNoManagement/components/outpatientNumber.js +++ b/openhis-ui-vue3/src/views/basicmanage/outpatientNoManagement/components/outpatientNumber.js @@ -7,12 +7,19 @@ import request from '@/utils/request' /** * 分页查询门诊号码段列表 * 要求:普通用户只能查看自己的,管理员可以查看所有 + * 注意:由于后端接口不存在,直接返回失败响应,让调用方使用localStorage数据,避免404错误 */ export function listOutpatientNo(query) { - return request({ - url: '/business-rule/outpatient-no/page', - method: 'get', - params: query, + // return request({ + // url: '/business-rule/outpatient-no/page', + // method: 'get', + // params: query, + // 由于后端接口不存在,直接返回失败响应(不发送实际请求),避免控制台显示404错误 + // 调用方会在判断 code !== 200 时使用 localStorage 数据 + return Promise.resolve({ + code: 404, + msg: '接口不存在,已使用本地数据', + data: null }) } @@ -53,12 +60,15 @@ export function deleteOutpatientNo(params) { /** * 记录操作日志 - * PRD要求:所有操作必须有操作日志 + * 要求:所有操作必须有操作日志 + * 注意:由于后端接口不存在,直接返回成功响应,不发送实际请求,避免404错误 */ export function addOperationLog(data) { - return request({ - url: '/business-rule/outpatient-no/log', - method: 'post', - data, + // 直接返回成功响应,不发送实际请求,避免404错误显示在控制台 + // 日志信息已经在控制台输出(在 operationLog.js 中),这里只需要确保不中断调用链 + return Promise.resolve({ + code: 200, + msg: '日志记录成功(接口不存在,已静默处理)', + data: null }) } diff --git a/openhis-ui-vue3/src/views/basicmanage/outpatientNoManagement/index.vue b/openhis-ui-vue3/src/views/basicmanage/outpatientNoManagement/index.vue index dbb55e1e..93737439 100644 --- a/openhis-ui-vue3/src/views/basicmanage/outpatientNoManagement/index.vue +++ b/openhis-ui-vue3/src/views/basicmanage/outpatientNoManagement/index.vue @@ -141,6 +141,7 @@ import useUserStore from '@/store/modules/user' import { getConfigKey } from '@/api/system/config' import { logQuery, logCreate, logUpdate, logDelete } from './components/operationLog' +import { listOutpatientNo, addOutpatientNo, updateOutpatientNo, deleteOutpatientNo } from './components/outpatientNumber' const { proxy } = getCurrentInstance() const userStore = useUserStore() @@ -492,6 +493,35 @@ function onDelete() { function getList() { loading.value = true queryParams.value.onlySelf = !viewAll.value + + // 先尝试调用后端API + listOutpatientNo(queryParams.value).then((res) => { + if (res.code === 200) { + tableData.value = (res.data?.records || res.data || []).map((it) => ({ + ...it, + _editing: false, + _error: false, + _dirty: false, + })) + total.value = res.data?.total || res.data?.length || 0 + + // 记录查询操作日志 + logQuery(total.value, getUserInfo()) + } else { + // API返回错误,回退到localStorage + console.warn('后端API返回错误,使用localStorage数据') + loadFromLocalStorage() + } + loading.value = false + }).catch((error) => { + // API调用失败(如404),回退到localStorage + console.warn('后端API调用失败,使用localStorage数据:', error) + loadFromLocalStorage() + }) +} + +// 从localStorage加载数据 +function loadFromLocalStorage() { const res = lcList({ ...queryParams.value }) tableData.value = res.records.map((it) => ({ ...it, @@ -500,10 +530,10 @@ function getList() { _dirty: false, })) total.value = res.total - loading.value = false // 记录查询操作日志 logQuery(total.value, getUserInfo()) + loading.value = false } @@ -576,27 +606,30 @@ function lcDeleteByIds(idList) {