fix(components): 菜单管理调整
This commit is contained in:
@@ -346,10 +346,6 @@ const pageResourceOptions = pageResourceItems.map(item => ({
|
||||
const selectedPageResource = computed(() => pageResourceMap.get(model.value.pageResourcePath) ?? null);
|
||||
|
||||
const displayRoutePath = computed(() => {
|
||||
if (selectedPageResource.value) {
|
||||
return selectedPageResource.value.path;
|
||||
}
|
||||
|
||||
return joinRoutePaths(currentParentFullPath.value, model.value.path);
|
||||
});
|
||||
|
||||
@@ -357,14 +353,6 @@ const hasCompatibleViewRouteData = computed(() =>
|
||||
Boolean(getNullableText(model.value.component) && getNullableText(model.value.path))
|
||||
);
|
||||
|
||||
const isSelectedPageResourceCompatible = computed(() => {
|
||||
if (!selectedPageResource.value) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return Boolean(getRelativeRoutePath(selectedPageResource.value.path, currentParentFullPath.value));
|
||||
});
|
||||
|
||||
const rules = computed(() => {
|
||||
const pathRule: RuleFormItem = {
|
||||
message: $t('page.system.menu.form.path'),
|
||||
@@ -403,11 +391,6 @@ const rules = computed(() => {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isSelectedPageResourceCompatible.value) {
|
||||
callback(new Error($t('page.system.menu.form.pageResourceParentMismatch')));
|
||||
return;
|
||||
}
|
||||
|
||||
callback();
|
||||
}
|
||||
};
|
||||
@@ -569,14 +552,16 @@ const parentTreeOptions = computed<ParentTreeOption[]>(() => {
|
||||
];
|
||||
});
|
||||
|
||||
function filterParentTreeNode(value: string, data: ParentTreeOption) {
|
||||
function filterParentTreeNode(value: string, data: { label?: string }) {
|
||||
const keyword = value.trim().toLowerCase();
|
||||
|
||||
if (!keyword) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return data.label.toLowerCase().includes(keyword);
|
||||
return String(data.label ?? '')
|
||||
.toLowerCase()
|
||||
.includes(keyword);
|
||||
}
|
||||
|
||||
function closeModal() {
|
||||
@@ -642,7 +627,13 @@ function syncViewRouteFields() {
|
||||
return;
|
||||
}
|
||||
|
||||
model.value.path = getRelativeRoutePath(pageResource.path, currentParentFullPath.value);
|
||||
const nextRelativePath =
|
||||
getRelativeRoutePath(pageResource.path, currentParentFullPath.value) ||
|
||||
normalizeRoutePart(model.value.path) ||
|
||||
normalizeRoutePart(pageResource.path).split('/').filter(Boolean).at(-1) ||
|
||||
'';
|
||||
|
||||
model.value.path = nextRelativePath;
|
||||
model.value.component = pageResource.component;
|
||||
model.value.componentName = pageResource.name;
|
||||
model.value.routePropsJson = stringifyRouteProps(pageResource.props as Record<string, unknown> | null);
|
||||
@@ -867,8 +858,11 @@ watch(
|
||||
|
||||
watch(
|
||||
() => model.value.parentId,
|
||||
() => {
|
||||
async () => {
|
||||
syncCurrentRouteFields();
|
||||
|
||||
await nextTick();
|
||||
clearFormValidation();
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user