fix: 路由跳转方法

This commit is contained in:
leiqiaochu 2023-02-23 10:58:50 +08:00
parent d526158076
commit cd1e08c055
4 changed files with 35 additions and 23 deletions

View File

@ -195,10 +195,11 @@ import { isNoCommunity, downloadObject } from '@/utils/utils';
import { omit } from 'lodash-es';
import { typeOptions } from '@/components/Search/util';
import Save from './Save/index.vue';
import { useMenuStore } from 'store/menu'
/**
* 表格数据
*/
const menuStory = useMenuStore()
const router = useRouter();
const isAdd = ref<number>(0);
const title = ref<string>('');
@ -426,7 +427,7 @@ const beforeUpload = (file: any) => {
* 查看
*/
const handleView = (id: string) => {
router.push('/iot/device/product/detail/' + id);
menuStory.jumpPage('device/Product/Detail',{id})
};
/**

View File

@ -348,9 +348,9 @@ import BindDevice from './BindDevice.vue';
import Import from './Import.vue';
import Export from './Export.vue';
import Save from './Save.vue';
import { useMenuStore } from 'store/menu'
const router = useRouter();
const menuStory = useMenuStore()
const cardManageRef = ref<Record<string, any>>({});
const params = ref<Record<string, any>>({});
const _selectedRowKeys = ref<string[]>([]);
@ -536,9 +536,10 @@ const getActions = (
},
icon: 'EyeOutlined',
onClick: () => {
router.push({
path: `/iot-card/CardManagement/detail/${data.id}`,
});
// router.push({
// path: `/iot-card/CardManagement/detail/${data.id}`,
// });
menuStory.jumpPage('iot-card/CardManagement/Detail',{id:data.id})
},
},
{

View File

@ -109,7 +109,7 @@ interface GuideItemProps {
index?: number;
auth: boolean;
}
const menuStory = useMenuStore();
const menuHasPermission = useMenuStore().hasPermission;
const btnHasPermission = usePermissionStore().hasPermission;
@ -134,14 +134,16 @@ const guideList = [
name: '平台对接',
english: 'STEP1',
auth: paltformPermission,
url: platformUrl,
// url: platformUrl,
url: 'iot-card/Platform/Detail',
},
{
key: 'SCREEN',
name: '物联卡管理',
english: 'STEP2',
auth: !!cardPermission,
url: cardUrl,
// url: cardUrl,
url: 'iot-card/CardManagement',
param: { save: true },
},
{
@ -149,7 +151,8 @@ const guideList = [
name: '操作记录',
english: 'STEP3',
auth: !!recordUrl,
url: recordUrl,
// url: recordUrl,
url: 'iot-card/Record',
},
];
@ -177,19 +180,25 @@ const pieChartData = ref<any[]>([
]);
const jumpPage = (data: GuideItemProps) => {
if (data.url && data.auth) {
router.push({ path: `${data.url}`, ...data.param });
// if (data.url && data.auth) {
// router.push({ path: `${data.url}`, ...data.param });
// } else {
// message.warning('');
// }
if (data.key === 'EQUIPMENT') {
menuStory.jumpPage(data.url, { id: 'add' });
} else {
message.warning('暂无权限,请联系管理员');
menuStory.jumpPage(data.url);
}
};
const jumpDashboard = () => {
if (dashBoardUrl) {
router.push(`${dashBoardUrl}`);
} else {
message.warning('暂无权限,请联系管理员');
}
// if (dashBoardUrl) {
// router.push(`${dashBoardUrl}`);
// } else {
// message.warning('');
// }
menuStory.jumpPage('iot-card/Dashboard');
};
/**

View File

@ -145,9 +145,9 @@ import { getImage } from '@/utils/comm';
import type { ActionsType } from '@/components/Table';
import { message } from 'ant-design-vue';
import { queryList, update, del } from '@/api/iot-card/platform';
import { useMenuStore } from 'store/menu'
const menuStory = useMenuStore()
const router = useRouter()
const platformRef = ref<Record<string, any>>({});
const params = ref<Record<string, any>>({});
@ -225,7 +225,8 @@ const getActions = (
},
icon: 'EditOutlined',
onClick: () => {
router.push(`/iot-card/Platform/detail/${data.id}`);
// router.push(`/iot-card/Platform/detail/${data.id}`);
menuStory.jumpPage('iot-card/Platform/Detail',{id:data.id});
},
},
{
@ -298,7 +299,7 @@ const handleSearch = (e: any) => {
* 新增
*/
const handleAdd = () => {
router.push(`/iot-card/Platform/detail/:id`)
menuStory.jumpPage('iot-card/Platform/Detail',{id:'add'})
};
</script>