feat(menu): 优化菜单路径唯一性校验并更新前端界面
- 在SysLoginController中添加optionMap数据返回 - 添加JSQLParser依赖支持MyBatis Plus功能 - 实现selectMenuByPathExcludeId方法用于排除当前菜单的路径唯一性校验 - 在SysMenuServiceImpl中添加日志记录并优化路径唯一性判断逻辑 - 在SysMenuMapper.xml中添加LIMIT 1限制并实现排除ID查询 - 在前端路由中注释患者管理相关路由配置 - 在用户store中添加optionMap配置项并优先从optionMap获取医院名称 - 重构检查项目设置页面的操作按钮样式为统一的圆形按钮设计 - 更新检查项目设置页面的导航栏样式和交互体验 - 优化门诊记录页面的搜索条件和表格展示功能 - 添加性别和状态筛选条件并改进数据加载逻辑
This commit is contained in:
@@ -144,10 +144,12 @@ import {
|
||||
getTenantPage,
|
||||
saveTenantOptionDetailList
|
||||
} from "@/api/system/tenant";
|
||||
import useUserStore from '@/store/modules/user';
|
||||
|
||||
const router = useRouter();
|
||||
const { proxy } = getCurrentInstance();
|
||||
const { sys_normal_disable } = proxy.useDict("sys_normal_disable");
|
||||
const userStore = useUserStore();
|
||||
|
||||
const dynamicFormList = ref([]);
|
||||
// 当前租户信息
|
||||
@@ -345,25 +347,42 @@ async function handleSetOption(row) {
|
||||
currentTenantId.value = row.id;
|
||||
currentTenantName.value = row.tenantName;
|
||||
optionTitle.value = `基本配置`;
|
||||
// 重置表单
|
||||
resetOption();
|
||||
optionForm.tenantId = row.id;
|
||||
// 获取动态表单配置
|
||||
const formListRes = await getTenantOptionFormList();
|
||||
console.log('动态表单配置:', formListRes);
|
||||
dynamicFormList.value = formListRes.data || [];
|
||||
// 获取租户已有配置
|
||||
const detailRes = await getTenantOptionDetailList(row.id);
|
||||
if (detailRes.data) {
|
||||
dynamicFormList.value.forEach(item => {
|
||||
const existingConfig = detailRes.data.find(c => c.code === item.code);
|
||||
item.content = existingConfig ? existingConfig.content : '';
|
||||
console.log('租户已有配置:', detailRes);
|
||||
console.log('租户已有配置数据:', detailRes.data);
|
||||
|
||||
// 填充已有配置值
|
||||
if (detailRes.data && Array.isArray(detailRes.data)) {
|
||||
console.log('开始填充配置值,detailRes.data.length:', detailRes.data.length);
|
||||
console.log('dynamicFormList.value.length:', dynamicFormList.value.length);
|
||||
|
||||
// 将已有配置数据转为 Map 方便查找
|
||||
const configMap = {};
|
||||
detailRes.data.forEach(config => {
|
||||
configMap[config.code] = config.content || '';
|
||||
});
|
||||
|
||||
dynamicFormList.value.forEach(item => {
|
||||
const existingContent = configMap[item.code];
|
||||
console.log(`配置项 ${item.code}, 找到配置值:`, existingContent);
|
||||
item.content = existingContent || '';
|
||||
});
|
||||
console.log('填充后的dynamicFormList:', dynamicFormList.value);
|
||||
} else {
|
||||
console.log('detailRes.data 不是数组或为空,初始化空内容');
|
||||
// 初始化空内容
|
||||
dynamicFormList.value.forEach(item => {
|
||||
item.content = '';
|
||||
});
|
||||
}
|
||||
|
||||
// 设置表单数据
|
||||
optionForm.tenantId = row.id;
|
||||
optionOpen.value = true;
|
||||
} catch (error) {
|
||||
console.error('获取配置项失败:', error);
|
||||
@@ -384,8 +403,14 @@ async function submitOptionForm() {
|
||||
loading.value = true;
|
||||
const res = await saveTenantOptionDetailList(submitData);
|
||||
if (res.code === 200) {
|
||||
proxy.$modal.msgSuccess("配置保存成功");
|
||||
optionOpen.value = false;
|
||||
// 如果修改的是当前登录用户的租户配置,需要刷新用户信息
|
||||
if (userStore.tenantId === optionForm.tenantId) {
|
||||
await userStore.getInfo();
|
||||
proxy.$modal.msgSuccess("配置保存成功,用户信息已刷新");
|
||||
} else {
|
||||
proxy.$modal.msgSuccess("配置保存成功");
|
||||
}
|
||||
} else {
|
||||
proxy.$modal.msgError(res.msg || "配置保存失败");
|
||||
}
|
||||
@@ -397,9 +422,6 @@ async function submitOptionForm() {
|
||||
}
|
||||
/** 重置配置项表单 */
|
||||
function resetOption() {
|
||||
dynamicFormList.value.forEach(item => {
|
||||
item.content = '';
|
||||
});
|
||||
if (proxy.$refs["optionRef"]) {
|
||||
proxy.$refs["optionRef"].resetFields();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user