字典修复

This commit is contained in:
JenniferW 2025-11-24 14:42:28 +08:00
parent df639d040a
commit f34bff1406
3 changed files with 35 additions and 2 deletions

View File

@ -85,6 +85,19 @@ export const constantRoutes = [
meta: { title: '个人中心', icon: 'user' }
}
]
},
{
path: '/system/dict/data',
component: Layout,
hidden: true,
children: [
{
path: 'index/:dictId?',
component: () => import('@/views/system/dict/data.vue'),
name: 'DictData',
meta: { title: '字典数据', activeMenu: '/system/dict' }
}
]
}
// 业务路由(订单管理、系统管理等)将从后端动态获取
];

View File

@ -193,6 +193,7 @@ const multiple = ref(true);
const total = ref(0);
const title = ref("");
const defaultDictType = ref("");
const currentDictId = ref("");
const typeOptions = ref([]);
const route = useRoute();
//
@ -225,6 +226,12 @@ const { queryParams, form, rules } = toRefs(data);
/** 查询字典类型详细 */
function getTypes(dictId) {
if (!dictId) {
queryParams.value.dictType = undefined;
defaultDictType.value = "";
getList();
return;
}
getType(dictId).then(response => {
queryParams.value.dictType = response.data.dictType;
defaultDictType.value = response.data.dictType;
@ -357,6 +364,16 @@ function handleExport() {
}, `dict_data_${new Date().getTime()}.xlsx`);
}
getTypes(route.params && route.params.dictId);
watch(
() => [route.params?.dictId, route.query?.dictId],
([newParam, newQuery]) => {
const nextDictId = newParam ?? newQuery ?? "";
if (nextDictId === currentDictId.value) return;
currentDictId.value = nextDictId;
getTypes(nextDictId);
},
{ immediate: true }
);
getTypeList();
</script>

View File

@ -107,7 +107,10 @@
<el-table-column label="字典名称" align="center" prop="dictName" :show-overflow-tooltip="true"/>
<el-table-column label="字典类型" align="center" :show-overflow-tooltip="true">
<template #default="scope">
<router-link :to="'/system/dict-data/index/' + scope.row.dictId" class="link-type">
<router-link
:to="`/system/dict/data/index/${scope.row.dictId}`"
class="link-type"
>
<span>{{ scope.row.dictType }}</span>
</router-link>
</template>