fix: 内嵌菜单移动导致跳转失败

This commit is contained in:
TsMask
2023-10-25 16:53:31 +08:00
parent 869c09ac3c
commit c3597b929e
3 changed files with 12 additions and 6 deletions

View File

@@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { useRouter } from 'vue-router'; import { useRouter, useRoute } from 'vue-router';
import { reactive, onMounted, toRaw } from 'vue'; import { reactive, onMounted, toRaw } from 'vue';
import { PageContainer } from '@ant-design-vue/pro-layout'; import { PageContainer } from '@ant-design-vue/pro-layout';
import { message, Modal, Form } from 'ant-design-vue/lib'; import { message, Modal, Form } from 'ant-design-vue/lib';
@@ -25,6 +25,8 @@ import { MENU_PATH_INLINE } from '@/constants/menu-constants';
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants'; import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
const { getDict } = useDictStore(); const { getDict } = useDictStore();
const router = useRouter(); const router = useRouter();
const route = useRoute();
const routePath = route.path;
/**字典数据 */ /**字典数据 */
let dict: { let dict: {
@@ -523,7 +525,7 @@ function fnExportList() {
/**跳转任务日志页面 */ /**跳转任务日志页面 */
function fnJobLogView(jobId: string | number = '0') { function fnJobLogView(jobId: string | number = '0') {
router.push(`/monitor/job${MENU_PATH_INLINE}/log/${jobId}`); router.push(`${routePath}${MENU_PATH_INLINE}/log/${jobId}`);
} }
/**查询定时任务列表 */ /**查询定时任务列表 */

View File

@@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { useRouter } from 'vue-router'; import { useRouter, useRoute } from 'vue-router';
import { reactive, ref, onMounted, toRaw } from 'vue'; import { reactive, ref, onMounted, toRaw } from 'vue';
import { PageContainer } from '@ant-design-vue/pro-layout'; import { PageContainer } from '@ant-design-vue/pro-layout';
import { message, Modal, Form } from 'ant-design-vue/lib'; import { message, Modal, Form } from 'ant-design-vue/lib';
@@ -22,6 +22,8 @@ import { MENU_PATH_INLINE } from '@/constants/menu-constants';
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants'; import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
const { getDict } = useDictStore(); const { getDict } = useDictStore();
const router = useRouter(); const router = useRouter();
const route = useRoute();
const routePath = route.path;
/**字典数据 */ /**字典数据 */
let dict: { let dict: {
@@ -415,7 +417,7 @@ function fnRefreshCache() {
/**跳转字典数据页面 */ /**跳转字典数据页面 */
function fnDataView(dictId: string | number = '0') { function fnDataView(dictId: string | number = '0') {
router.push(`/system/dict${MENU_PATH_INLINE}/data/${dictId}`); router.push(`${routePath}${MENU_PATH_INLINE}/data/${dictId}`);
} }
/**查询参数配置列表 */ /**查询参数配置列表 */

View File

@@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { useRouter } from 'vue-router'; import { useRouter, useRoute } from 'vue-router';
import { reactive, ref, onMounted, toRaw } from 'vue'; import { reactive, ref, onMounted, toRaw } from 'vue';
import { PageContainer } from '@ant-design-vue/pro-layout'; import { PageContainer } from '@ant-design-vue/pro-layout';
import { message, Modal, Form } from 'ant-design-vue/lib'; import { message, Modal, Form } from 'ant-design-vue/lib';
@@ -28,6 +28,8 @@ import { MENU_PATH_INLINE } from '@/constants/menu-constants';
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants'; import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
const { getDict } = useDictStore(); const { getDict } = useDictStore();
const router = useRouter(); const router = useRouter();
const route = useRoute();
const routePath = route.path;
/**字典数据 */ /**字典数据 */
let dict: { let dict: {
@@ -568,7 +570,7 @@ function fnRecordDataScope(roleId: string | number) {
*/ */
function fnRecordAuthUser(row: Record<string, string>) { function fnRecordAuthUser(row: Record<string, string>) {
router.push({ router.push({
path: `/system/role${MENU_PATH_INLINE}/auth-user/${row.roleId}`, path: `${routePath}${MENU_PATH_INLINE}/auth-user/${row.roleId}`,
query: { query: {
roleName: row.roleName, roleName: row.roleName,
}, },