feat(home): 添加医生专属患者统计和菜单跳转功能
- 在HomeStatisticsDto中新增我的患者数量和待写病历数量字段 - 实现医生患者查询功能,支持按租户隔离数据 - 更新首页统计服务,为医生用户提供专属患者统计数据 - 添加菜单名称点击跳转功能,支持路由导航和外部链接打开 - 修复首页统计数据显示,确保医生看到正确的患者数量 - 添加医保日结结算相关实体、服务和前端页面 - 配置前端路由控制器,支持Vue Router History模式
This commit is contained in:
@@ -65,7 +65,19 @@
|
||||
:default-expand-all="isExpandAll"
|
||||
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
|
||||
>
|
||||
<el-table-column prop="menuName" label="菜单名称" :show-overflow-tooltip="true" width="160"></el-table-column>
|
||||
<el-table-column prop="menuName" label="菜单名称" :show-overflow-tooltip="true" width="160">
|
||||
<template #default="scope">
|
||||
<span
|
||||
v-if="scope.row.menuType === 'C'"
|
||||
class="menu-name-link"
|
||||
@click="handleMenuClick(scope.row)"
|
||||
:title="`点击跳转到${scope.row.menuName}模块`"
|
||||
style="cursor: pointer; color: #409EFF;">
|
||||
{{ scope.row.menuName }}
|
||||
</span>
|
||||
<span v-else>{{ scope.row.menuName }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="icon" label="图标" align="center" width="100">
|
||||
<template #default="scope">
|
||||
<svg-icon :icon-class="scope.row.icon" />
|
||||
@@ -302,10 +314,17 @@
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.menu-name-link:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script setup name="Menu">
|
||||
import {addMenu, delMenu, getMenu, listMenu, updateMenu, treeselect} from "@/api/system/menu";
|
||||
import SvgIcon from "@/components/SvgIcon";
|
||||
import IconSelect from "@/components/IconSelect";
|
||||
import {getNormalPath} from "@/utils/openhis";
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
const { sys_show_hide, sys_normal_disable } = proxy.useDict("sys_show_hide", "sys_normal_disable");
|
||||
@@ -495,5 +514,70 @@ function handleDelete(row) {
|
||||
}).catch(() => {});
|
||||
}
|
||||
|
||||
/** 处理菜单点击事件,跳转到对应功能模块 */
|
||||
function handleMenuClick(row) {
|
||||
// 只有菜单类型(C)才会进入此函数,因为模板中已限制
|
||||
// 检查菜单是否有对应的路由路径
|
||||
if (!row.path) {
|
||||
proxy.$modal.msgWarning(`${row.menuName} 暂无对应的功能模块`);
|
||||
return;
|
||||
}
|
||||
|
||||
// 如果是外部链接,新开窗口打开
|
||||
if (row.isFrame === '0' && (row.path.startsWith('http://') || row.path.startsWith('https://'))) {
|
||||
window.open(row.path, '_blank');
|
||||
return;
|
||||
}
|
||||
|
||||
// 使用完整路径作为主要路径,但如果它包含 /system 前缀而原始路径不包含,
|
||||
// 则使用原始路径,以避免路由系统添加额外的 /system 前缀
|
||||
let routePath = row.fullPath || row.path;
|
||||
|
||||
// 特殊处理:如果完整路径以 /system/ 开头,但菜单本身路径不包含 /system/,
|
||||
// 则使用菜单路径,避免重复添加 /system 前缀
|
||||
if (row.fullPath && row.path &&
|
||||
row.fullPath.startsWith('/system/') &&
|
||||
!row.path.startsWith('/system/')) {
|
||||
routePath = row.path;
|
||||
}
|
||||
|
||||
// 确保路径以 / 开头
|
||||
if (!routePath.startsWith('/')) {
|
||||
routePath = '/' + routePath;
|
||||
}
|
||||
|
||||
// 规范化路径,处理可能的路径问题
|
||||
const normalizedPath = getNormalPath(routePath);
|
||||
|
||||
// 尝试导航到对应路由
|
||||
try {
|
||||
// 使用 router.push 导航到目标路由
|
||||
proxy.$router.push({
|
||||
path: normalizedPath
|
||||
}).catch(err => {
|
||||
// 如果路由导航失败,尝试另一种方式
|
||||
console.error(`路由导航失败,尝试备用方案: ${normalizedPath}`, err);
|
||||
|
||||
// 尝试使用 name 进行路由跳转(如果菜单有路由名称)
|
||||
if (row.routeName) {
|
||||
try {
|
||||
proxy.$router.push({ name: row.routeName }).catch(nameErr => {
|
||||
console.error(`使用路由名称跳转也失败: ${row.routeName}`, nameErr);
|
||||
proxy.$modal.msgError(`${row.menuName} 模块暂无法访问,请检查权限或联系管理员`);
|
||||
});
|
||||
} catch (nameErr) {
|
||||
console.error(`使用路由名称跳转异常: ${row.routeName}`, nameErr);
|
||||
proxy.$modal.msgError(`${row.menuName} 模块跳转失败`);
|
||||
}
|
||||
} else {
|
||||
proxy.$modal.msgError(`${row.menuName} 模块暂无法访问,请检查权限或联系管理员`);
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
console.error(`跳转到 ${row.menuName} 模块失败:`, error);
|
||||
proxy.$modal.msgError(`${row.menuName} 模块跳转失败`);
|
||||
}
|
||||
}
|
||||
|
||||
getList();
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user