--添加测试模块
This commit is contained in:
@ -2,10 +2,11 @@ import type { RouteLocationRaw, Router } from 'vue-router';
|
||||
|
||||
import { PageEnum } from '/@/enums/pageEnum';
|
||||
import { isString } from '/@/utils/is';
|
||||
import { unref } from 'vue';
|
||||
import { unref, nextTick } from 'vue';
|
||||
|
||||
import { useRouter } from 'vue-router';
|
||||
import { REDIRECT_NAME } from '/@/router/constant';
|
||||
import { useMultipleTabStore } from '/@/store/modules/multipleTab';
|
||||
|
||||
export type RouteLocationRawEx = Omit<RouteLocationRaw, 'path'> & { path: PageEnum };
|
||||
|
||||
@ -13,6 +14,8 @@ function handleError(e: Error) {
|
||||
console.error(e);
|
||||
}
|
||||
|
||||
const specialRouterName = ['CreateFlow', 'ApproveFlow', 'viewForm', 'ProcessMonitoring', 'updateForm', 'createForm']
|
||||
|
||||
// page switch
|
||||
export function useGo(_router?: Router) {
|
||||
let router;
|
||||
@ -39,11 +42,12 @@ export function useGo(_router?: Router) {
|
||||
/**
|
||||
* @description: redo current page
|
||||
*/
|
||||
export const useRedo = (_router?: Router) => {
|
||||
export const useRedo = (_router?: Router) => {
|
||||
const tabStore = useMultipleTabStore();
|
||||
const { push, currentRoute } = _router || useRouter();
|
||||
const { query, params = {}, name, fullPath } = unref(currentRoute.value);
|
||||
function redo(): Promise<boolean> {
|
||||
return new Promise((resolve) => {
|
||||
const { query, params = {}, name, fullPath, path } = unref(currentRoute.value);
|
||||
function redo(): Promise<boolean> {
|
||||
return new Promise(async(resolve) => {
|
||||
if (name === REDIRECT_NAME) {
|
||||
resolve(false);
|
||||
return;
|
||||
@ -55,7 +59,14 @@ export const useRedo = (_router?: Router) => {
|
||||
params['_redirect_type'] = 'path';
|
||||
params['path'] = fullPath;
|
||||
}
|
||||
push({ name: REDIRECT_NAME, params, query }).then(() => resolve(true));
|
||||
if(specialRouterName.includes(name)){
|
||||
await tabStore.closeTab(currentRoute.value, _router || useRouter())
|
||||
nextTick(() => {
|
||||
push({ path: path, params, query }).then(() => resolve(true));
|
||||
})
|
||||
} else {
|
||||
push({ name: REDIRECT_NAME, params, query }).then(() => resolve(true));
|
||||
}
|
||||
});
|
||||
}
|
||||
return redo;
|
||||
|
||||
@ -60,6 +60,14 @@ export function usePermission() {
|
||||
closeAll();
|
||||
}
|
||||
|
||||
function hasAllPermission(value?: RoleEnum | RoleEnum[] | string | string[], def = true): boolean {
|
||||
if (!value) {
|
||||
return def;
|
||||
}
|
||||
const allPerm = permissionStore.getAllButtonPermCodeList
|
||||
return allPerm.includes(value as string)
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether there is permission
|
||||
*/
|
||||
@ -269,6 +277,7 @@ export function usePermission() {
|
||||
return {
|
||||
changeRole,
|
||||
hasPermission,
|
||||
hasAllPermission,
|
||||
togglePermissionMode,
|
||||
refreshMenu,
|
||||
changeMenu,
|
||||
|
||||
@ -245,6 +245,8 @@ function getSchemePermissionItem(
|
||||
if (isViewProcess) {
|
||||
schema.dynamicDisabled = true;
|
||||
}
|
||||
} else if(schema.componentProps?.alwaysShow===true){
|
||||
schema.show=true;
|
||||
} else {
|
||||
schema.show = false;
|
||||
schema.dynamicDisabled = true;
|
||||
|
||||
Reference in New Issue
Block a user