update: 优化北向输出跳转
This commit is contained in:
parent
1460ebcdbb
commit
754fe63fc1
|
@ -74,12 +74,20 @@ export const useMenuStore = defineStore({
|
|||
hasMenu(code: string) {
|
||||
return this.menus[code]?.path
|
||||
},
|
||||
jumpPage(code: string, params: Record<string, any>, query: Record<string, any>) {
|
||||
const path = this.menus[code]?.path
|
||||
/**
|
||||
* 路由跳转
|
||||
* @param name 菜单code
|
||||
* @param params 路由参数
|
||||
* @param query 路由参数
|
||||
*/
|
||||
jumpPage(name: string, params?: Record<string, any>, query?: Record<string, any>) {
|
||||
const path = this.hasMenu(name)
|
||||
if (path) {
|
||||
router.push({
|
||||
path, params, query
|
||||
name, params, query
|
||||
})
|
||||
} else {
|
||||
console.warn(`没有找到对应的页面: ${name}`)
|
||||
}
|
||||
},
|
||||
queryMenuTree(isCommunity = false): Promise<any[]> {
|
||||
|
|
|
@ -151,12 +151,15 @@ import {
|
|||
import type { ActionsType } from '@/components/Table/index.vue';
|
||||
import { getImage } from '@/utils/comm';
|
||||
import { message } from 'ant-design-vue';
|
||||
import { useMenuStore } from 'store/menu'
|
||||
|
||||
const router = useRouter();
|
||||
const instanceRef = ref<Record<string, any>>({});
|
||||
const params = ref<Record<string, any>>({});
|
||||
const current = ref<Record<string, any>>({});
|
||||
|
||||
const menuStory = useMenuStore()
|
||||
|
||||
const statusMap = new Map();
|
||||
statusMap.set('enabled', 'success');
|
||||
statusMap.set('disabled', 'error');
|
||||
|
@ -209,19 +212,14 @@ const columns = [
|
|||
* 新增
|
||||
*/
|
||||
const handleAdd = () => {
|
||||
router.push('/iot/northbound/AliCloud/detail/:id');
|
||||
menuStory.jumpPage('Northbound/AliCloud/Detail', { id: ':id'})
|
||||
};
|
||||
|
||||
/**
|
||||
* 查看
|
||||
*/
|
||||
const handleView = (id: string) => {
|
||||
router.push({
|
||||
path: '/iot/northbound/AliCloud/detail/' + id,
|
||||
query: {
|
||||
type: 'view'
|
||||
}
|
||||
});
|
||||
menuStory.jumpPage('Northbound/AliCloud/Detail', { id }, { type: 'view'})
|
||||
};
|
||||
|
||||
const getActions = (
|
||||
|
@ -249,12 +247,7 @@ const getActions = (
|
|||
},
|
||||
icon: 'EditOutlined',
|
||||
onClick: () => {
|
||||
router.push({
|
||||
path: '/iot/northbound/AliCloud/detail/' + data.id,
|
||||
query: {
|
||||
type: 'edit'
|
||||
}
|
||||
});
|
||||
menuStory.jumpPage('Northbound/AliCloud/Detail', { id: data.id }, { type: 'edit'})
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
|
@ -147,11 +147,13 @@ import { query, _undeploy, _deploy, _delete, queryProductList, queryTypes } from
|
|||
import type { ActionsType } from '@/components/Table/index.vue';
|
||||
import { getImage } from '@/utils/comm';
|
||||
import { message } from 'ant-design-vue';
|
||||
import { useMenuStore } from 'store/menu'
|
||||
|
||||
const router = useRouter();
|
||||
const instanceRef = ref<Record<string, any>>({});
|
||||
const params = ref<Record<string, any>>({});
|
||||
const current = ref<Record<string, any>>({});
|
||||
const menuStory = useMenuStore()
|
||||
|
||||
const statusMap = new Map();
|
||||
statusMap.set('enabled', 'success');
|
||||
|
@ -236,20 +238,14 @@ const columns = [
|
|||
* 新增
|
||||
*/
|
||||
const handleAdd = () => {
|
||||
router.push('/iot/northbound/DuerOS/detail/:id');
|
||||
menuStory.jumpPage('Northbound/DuerOS/Detail', { id: ':id'})
|
||||
};
|
||||
|
||||
/**
|
||||
* 查看
|
||||
*/
|
||||
const handleView = (id: string) => {
|
||||
// router.push('/iot/northbound/DuerOS/detail/' + id);
|
||||
router.push({
|
||||
path: '/iot/northbound/DuerOS/detail/' + id,
|
||||
query: {
|
||||
type: 'view',
|
||||
},
|
||||
});
|
||||
menuStory.jumpPage('Northbound/DuerOS/Detail', { id }, { type: 'view' })
|
||||
};
|
||||
|
||||
const getActions = (
|
||||
|
@ -277,12 +273,7 @@ const getActions = (
|
|||
},
|
||||
icon: 'EditOutlined',
|
||||
onClick: () => {
|
||||
router.push({
|
||||
path: '/iot/northbound/DuerOS/detail/' + data.id,
|
||||
query: {
|
||||
type: 'edit',
|
||||
},
|
||||
});
|
||||
menuStory.jumpPage('Northbound/DuerOS/Detail', { id: data.id }, { type: 'edit' })
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue