mirror of
https://gitee.com/nicefold/seewis-soybean-plus.git
synced 2026-10-14 10:02:13 +08:00
feat(projects): Iframe 类型菜单传参更改
This commit is contained in:
@@ -29,8 +29,8 @@ UPDATE `sys_menu` SET `icon` = 'gg:debug', `menu_name` = 'route.demo_tree' WHERE
|
||||
UPDATE `sys_menu` SET `path` = 'oss/config', `component` = 'system/oss-config/index', `icon` = 'hugeicons:configuration-01', `menu_name` = 'route.system_oss-config' WHERE `menu_id` = 133;
|
||||
|
||||
-- IFrame 类型
|
||||
UPDATE `sys_menu` SET `component` = 'FrameView', `query_param` = 'https://ruoyi.xlsea.cn/admin/', `is_frame` = 2, `icon` = 'bx:bxl-spring-boot', `menu_name` = 'menu.monitor_admin' WHERE `menu_id` = 117;
|
||||
UPDATE `sys_menu` SET `component` = 'FrameView', `query_param` = 'https://preview.snailjob.opensnail.com/', `is_frame` = 2, `icon` = 'gridicons:scheduled', `menu_name` = 'menu.monitor_snail-job' WHERE `menu_id` = 120;
|
||||
UPDATE `sys_menu` SET `component` = 'FrameView', `query_param` = '{"url": "https://ruoyi.xlsea.cn/admin/"}', `is_frame` = 2, `icon` = 'bx:bxl-spring-boot', `menu_name` = 'menu.monitor_admin' WHERE `menu_id` = 117;
|
||||
UPDATE `sys_menu` SET `component` = 'FrameView', `query_param` = '{"url": "https://preview.snailjob.opensnail.com/"}', `is_frame` = 2, `icon` = 'gridicons:scheduled', `menu_name` = 'menu.monitor_snail-job' WHERE `menu_id` = 120;
|
||||
-- 外链类型
|
||||
UPDATE `sys_menu` SET `path` = 'https://gitee.com/xlsea/ruoyi-plus-soybean', `component` = 'FrameView', `icon` = 'local-icon-gitee', `menu_name` = 'RuoYi-Plus-Soybean' WHERE `menu_id` = 4;
|
||||
|
||||
|
||||
@@ -142,10 +142,12 @@ export const useRouteStore = defineStore(SetupStoreId.Route, () => {
|
||||
route.name = random;
|
||||
route.component = 'layout.base$view.iframe-page';
|
||||
} else {
|
||||
try {
|
||||
route.props = {
|
||||
// @ts-expect-error no query field
|
||||
url: route.query
|
||||
url: JSON.parse(route.query)?.url
|
||||
};
|
||||
} catch {}
|
||||
}
|
||||
route.component = parent && !isExternalLink ? 'view.iframe-page' : 'layout.base$view.iframe-page';
|
||||
} else if (!isLayout && !isParentLayout) {
|
||||
|
||||
@@ -322,6 +322,14 @@ const btnColumns: DataTableColumns<Api.System.Menu> = [
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
const renderIframeQuery = (queryParam: string) => {
|
||||
try {
|
||||
return JSON.parse(queryParam || '{}')?.url;
|
||||
} catch {
|
||||
return queryParam;
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -461,12 +469,15 @@ const btnColumns: DataTableColumns<Api.System.Menu> = [
|
||||
>
|
||||
{{ currentMenu.path }}
|
||||
</NDescriptionsItem>
|
||||
<NDescriptionsItem
|
||||
v-if="isMenu && !isExternalType"
|
||||
:label="!isIframeType ? $t('page.system.menu.query') : $t('page.system.menu.iframeQuery')"
|
||||
>
|
||||
<NDescriptionsItem v-if="isMenu && !isExternalType && !isIframeType" :label="$t('page.system.menu.query')">
|
||||
{{ currentMenu.queryParam }}
|
||||
</NDescriptionsItem>
|
||||
<NDescriptionsItem
|
||||
v-if="isMenu && !isExternalType && isIframeType"
|
||||
:label="$t('page.system.menu.iframeQuery')"
|
||||
>
|
||||
{{ renderIframeQuery(currentMenu.queryParam) }}
|
||||
</NDescriptionsItem>
|
||||
<NDescriptionsItem v-if="!isCatalog" :label="$t('page.system.menu.perms')">
|
||||
{{ currentMenu.perms }}
|
||||
</NDescriptionsItem>
|
||||
|
||||
@@ -133,7 +133,14 @@ function handleInitModel() {
|
||||
if (model.isFrame === '1') {
|
||||
const queryObj: { [key: string]: string } = JSON.parse(model.queryParam || '{}');
|
||||
queryList.value = Object.keys(queryObj).map(item => ({ key: item, value: queryObj[item] }));
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
if (model.isFrame === '2') {
|
||||
model.queryParam = JSON.parse(model.queryParam || '{}')?.url || '';
|
||||
}
|
||||
} catch {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -173,7 +180,7 @@ function processQueryParam(queryParam: string | null | undefined): string {
|
||||
|
||||
// iframe类型,直接使用原始参数
|
||||
if (isIframeType.value) {
|
||||
return queryParam || '';
|
||||
return queryParam ? `{"url": "${queryParam}"}` : '';
|
||||
}
|
||||
|
||||
return '';
|
||||
|
||||
Reference in New Issue
Block a user