fix 修复 vue 类型识别问题

This commit is contained in:
ahao 2023-12-27 12:12:51 +08:00
parent 321f21c498
commit 3922c16601
19 changed files with 204 additions and 91 deletions

View File

@ -36,7 +36,7 @@ const show = ref(false);
const fuse = ref();
const headerSearchSelectRef = ref<ElSelectInstance>();
const router = useRouter();
const routes = computed(() => usePermissionStore().routes);
const routes = computed(() => usePermissionStore().getRoutes());
const click = () => {
show.value = !show.value;
@ -149,7 +149,7 @@ watch(show, (value) => {
}
});
watch(searchPool, (list) => {
watch(searchPool, (list: Router) => {
initFuse(list);
});
</script>

View File

@ -81,14 +81,14 @@ const imageUploadRef = ref<ElUploadInstance>();
watch(
() => props.modelValue,
async (val) => {
async (val: string) => {
if (val) {
//
let list: OssVO[] = [];
if (Array.isArray(val)) {
list = val as OssVO[];
} else {
const res = await listByIds(val as string);
const res = await listByIds(val);
list = res.data;
}
//

View File

@ -43,7 +43,7 @@ const router = useRouter();
//
const theme = computed(() => settingsStore.theme);
//
const routers = computed(() => permissionStore.topbarRouters);
const routers = computed(() => permissionStore.getTopbarRoutes());
//
const topMenus = computed(() => {

View File

@ -12,8 +12,9 @@
</template>
<script setup name="AppMain" lang="ts">
import useTagsViewStore from '@/store/modules/tagsView';
import useSettingsStore from '@/store/modules/settings';
import useTagsViewStore from '@/store/modules/tagsView';
import IframeToggle from './IframeToggle/index.vue';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const tagsViewStore = useTagsViewStore();

View File

@ -10,6 +10,7 @@
<script setup lang="ts">
import InnerLink from '../InnerLink/index.vue';
import useTagsViewStore from '@/store/modules/tagsView';
const route = useRoute();

View File

@ -35,7 +35,7 @@ const route = useRoute();
const appStore = useAppStore();
const settingsStore = useSettingsStore();
const permissionStore = usePermissionStore();
const sidebarRouters = computed<RouteRecordRaw[]>(() => permissionStore.sidebarRouters);
const sidebarRouters = computed<RouteRecordRaw[]>(() => permissionStore.getSidebarRoutes());
const showLogo = computed(() => settingsStore.sidebarLogo);
const sideTheme = computed(() => settingsStore.sideTheme);
const theme = computed(() => settingsStore.theme);

View File

@ -5,13 +5,13 @@
</template>
<script setup lang="ts">
import { RouteLocationNormalized } from 'vue-router';
import useTagsViewStore from '@/store/modules/tagsView';
import { TagView } from 'vue-router';
const tagAndTagSpacing = ref(4);
const scrollContainerRef = ref<ElScrollbarInstance>();
const scrollWrapper = computed(() => scrollContainerRef.value?.$refs.wrapRef as any);
const scrollWrapper = computed(() => scrollContainerRef.value?.$refs.wrapRef);
onMounted(() => {
scrollWrapper.value?.addEventListener('scroll', emitScroll, true);
@ -33,7 +33,7 @@ const emitScroll = () => {
const tagsViewStore = useTagsViewStore();
const visitedViews = computed(() => tagsViewStore.visitedViews);
const moveToTarget = (currentTag: TagView) => {
const moveToTarget = (currentTag: RouteLocationNormalized) => {
const $container = scrollContainerRef.value?.$el;
const $containerWidth = $container.offsetWidth;
const $scrollWrapper = scrollWrapper.value;

View File

@ -32,24 +32,24 @@
<script setup lang="ts">
import ScrollPane from './ScrollPane.vue';
import { getNormalPath } from '@/utils/ruoyi';
import useTagsViewStore from '@/store/modules/tagsView';
import useSettingsStore from '@/store/modules/settings';
import usePermissionStore from '@/store/modules/permission';
import { RouteRecordRaw, TagView } from 'vue-router';
import useTagsViewStore from '@/store/modules/tagsView';
import { RouteRecordRaw, RouteLocationNormalized } from 'vue-router';
const visible = ref(false);
const top = ref(0);
const left = ref(0);
const selectedTag = ref<TagView>({});
const affixTags = ref<TagView[]>([]);
const selectedTag = ref<RouteLocationNormalized>();
const affixTags = ref<RouteLocationNormalized[]>([]);
const scrollPaneRef = ref<InstanceType<typeof ScrollPane>>();
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const route = useRoute();
const router = useRouter();
const visitedViews = computed(() => useTagsViewStore().visitedViews);
const routes = computed(() => usePermissionStore().routes);
const visitedViews = computed(() => useTagsViewStore().getVisitedViews());
const routes = computed(() => usePermissionStore().getRoutes());
const theme = computed(() => useSettingsStore().theme);
watch(route, () => {
@ -64,18 +64,18 @@ watch(visible, (value) => {
}
});
const isActive = (r: TagView): boolean => {
const isActive = (r: RouteLocationNormalized): boolean => {
return r.path === route.path;
};
const activeStyle = (tag: TagView) => {
const activeStyle = (tag: RouteLocationNormalized) => {
if (!isActive(tag)) return {};
return {
'background-color': theme.value,
'border-color': theme.value
};
};
const isAffix = (tag: TagView) => {
return tag.meta && tag.meta.affix;
const isAffix = (tag: RouteLocationNormalized) => {
return tag?.meta && tag?.meta?.affix;
};
const isFirstView = () => {
try {
@ -92,12 +92,17 @@ const isLastView = () => {
}
};
const filterAffixTags = (routes: RouteRecordRaw[], basePath = '') => {
let tags: TagView[] = [];
let tags: RouteLocationNormalized[] = [];
routes.forEach((route) => {
if (route.meta && route.meta.affix) {
const tagPath = getNormalPath(basePath + '/' + route.path);
tags.push({
hash: '',
matched: [],
params: undefined,
query: undefined,
redirectedFrom: undefined,
fullPath: tagPath,
path: tagPath,
name: route.name as string,
@ -114,7 +119,7 @@ const filterAffixTags = (routes: RouteRecordRaw[], basePath = '') => {
return tags;
};
const initTags = () => {
const res = filterAffixTags(routes.value as any);
const res = filterAffixTags(routes.value);
affixTags.value = res;
for (const tag of res) {
// Must have tag name
@ -143,19 +148,19 @@ const moveToCurrentTag = () => {
scrollPaneRef.value?.moveToTarget(r);
// when query is different then update
if (r.fullPath !== route.fullPath) {
useTagsViewStore().updateVisitedView(route as any);
useTagsViewStore().updateVisitedView(route);
}
}
}
});
};
const refreshSelectedTag = (view: TagView) => {
const refreshSelectedTag = (view: RouteLocationNormalized) => {
proxy?.$tab.refreshPage(view);
if (route.meta.link) {
useTagsViewStore().delIframeView(route as any);
useTagsViewStore().delIframeView(route);
}
};
const closeSelectedTag = (view: TagView) => {
const closeSelectedTag = (view: RouteLocationNormalized) => {
proxy?.$tab.closePage(view).then(({ visitedViews }: any) => {
if (isActive(view)) {
toLastView(visitedViews, view);
@ -163,15 +168,15 @@ const closeSelectedTag = (view: TagView) => {
});
};
const closeRightTags = () => {
proxy?.$tab.closeRightPage(selectedTag.value).then((visitedViews: TagView[]) => {
if (!visitedViews.find((i: TagView) => i.fullPath === route.fullPath)) {
proxy?.$tab.closeRightPage(selectedTag.value).then((visitedViews: RouteLocationNormalized[]) => {
if (!visitedViews.find((i: RouteLocationNormalized) => i.fullPath === route.fullPath)) {
toLastView(visitedViews);
}
});
};
const closeLeftTags = () => {
proxy?.$tab.closeLeftPage(selectedTag.value).then((visitedViews: TagView[]) => {
if (!visitedViews.find((i: TagView) => i.fullPath === route.fullPath)) {
proxy?.$tab.closeLeftPage(selectedTag.value).then((visitedViews: RouteLocationNormalized[]) => {
if (!visitedViews.find((i: RouteLocationNormalized) => i.fullPath === route.fullPath)) {
toLastView(visitedViews);
}
});
@ -182,7 +187,7 @@ const closeOthersTags = () => {
moveToCurrentTag();
});
};
const closeAllTags = (view: TagView) => {
const closeAllTags = (view: RouteLocationNormalized) => {
proxy?.$tab.closeAllPage().then(({ visitedViews }) => {
if (affixTags.value.some((tag) => tag.path === route.path)) {
return;
@ -190,7 +195,7 @@ const closeAllTags = (view: TagView) => {
toLastView(visitedViews, view);
});
};
const toLastView = (visitedViews: TagView[], view?: TagView) => {
const toLastView = (visitedViews: RouteLocationNormalized[], view?: RouteLocationNormalized) => {
const latestView = visitedViews.slice(-1)[0];
if (latestView) {
router.push(latestView.fullPath as string);
@ -205,7 +210,7 @@ const toLastView = (visitedViews: TagView[], view?: TagView) => {
}
}
};
const openMenu = (tag: TagView, e: MouseEvent) => {
const openMenu = (tag: RouteLocationNormalized, e: MouseEvent) => {
const menuMinWidth = 105;
const offsetLeft = proxy?.$el.getBoundingClientRect().left; // container margin left
const offsetWidth = proxy?.$el.offsetWidth; // container width

View File

@ -1,19 +1,29 @@
import { useTagsViewStore } from '@/store/modules/tagsView';
import router from '@/router';
import { TagView, RouteLocationMatched } from 'vue-router';
import { RouteLocationMatched, RouteLocationNormalized } from 'vue-router';
import useTagsViewStore from '@/store/modules/tagsView';
export default {
/**
* tab页签
* @param obj
*/
async refreshPage(obj?: TagView): Promise<void> {
async refreshPage(obj?: RouteLocationNormalized): Promise<void> {
const { path, query, matched } = router.currentRoute.value;
if (obj === undefined) {
matched.forEach((m: RouteLocationMatched) => {
if (m.components && m.components.default && m.components.default.name) {
if (!['Layout', 'ParentView'].includes(m.components.default.name)) {
obj = { name: m.components.default.name, path: path, query: query };
obj = {
name: m.components.default.name,
path: path,
query: query,
matched: undefined,
fullPath: undefined,
hash: undefined,
params: undefined,
redirectedFrom: undefined,
meta: undefined
};
}
}
});
@ -31,20 +41,20 @@ export default {
});
},
// 关闭当前tab页签打开新页签
closeOpenPage(obj: TagView): void {
useTagsViewStore().delView(router.currentRoute.value as any);
closeOpenPage(obj: RouteLocationNormalized): void {
useTagsViewStore().delView(router.currentRoute.value);
if (obj !== undefined) {
router.push(obj);
}
},
// 关闭指定tab页签
async closePage(obj?: TagView): Promise<{ visitedViews: TagView[]; cachedViews: string[] } | any> {
async closePage(obj?: RouteLocationNormalized): Promise<{ visitedViews: RouteLocationNormalized[]; cachedViews: string[] } | any> {
if (obj === undefined) {
// prettier-ignore
const { visitedViews } = await useTagsViewStore().delView(router.currentRoute.value as any)
const { visitedViews } = await useTagsViewStore().delView(router.currentRoute.value)
const latestView = visitedViews.slice(-1)[0];
if (latestView) {
return router.push(latestView.fullPath as any);
return router.push(latestView.fullPath);
}
return router.push('/');
}
@ -55,16 +65,16 @@ export default {
return useTagsViewStore().delAllViews();
},
// 关闭左侧tab页签
closeLeftPage(obj?: TagView) {
return useTagsViewStore().delLeftTags(obj || (router.currentRoute.value as any));
closeLeftPage(obj?: RouteLocationNormalized) {
return useTagsViewStore().delLeftTags(obj || router.currentRoute.value);
},
// 关闭右侧tab页签
closeRightPage(obj?: TagView) {
return useTagsViewStore().delRightTags(obj || (router.currentRoute.value as any));
closeRightPage(obj?: RouteLocationNormalized) {
return useTagsViewStore().delRightTags(obj || router.currentRoute.value);
},
// 关闭其他tab页签
closeOtherPage(obj?: TagView) {
return useTagsViewStore().delOthersViews(obj || (router.currentRoute.value as any));
closeOtherPage(obj?: RouteLocationNormalized) {
return useTagsViewStore().delOthersViews(obj || router.currentRoute.value);
},
/**
* tab页签
@ -80,7 +90,7 @@ export default {
* tab页签
* @param obj
*/
updatePage(obj: TagView) {
updatePage(obj: RouteLocationNormalized) {
return useTagsViewStore().updateVisitedView(obj);
}
};

View File

@ -18,6 +18,16 @@ export const usePermissionStore = defineStore('permission', () => {
const topbarRouters = ref<RouteRecordRaw[]>([]);
const sidebarRouters = ref<RouteRecordRaw[]>([]);
const getRoutes = (): RouteRecordRaw[] => {
return routes.value;
};
const getSidebarRoutes = (): RouteRecordRaw[] => {
return sidebarRouters.value;
};
const getTopbarRoutes = (): RouteRecordRaw[] => {
return topbarRouters.value;
};
const setRoutes = (newRoutes: RouteRecordRaw[]): void => {
addRoutes.value = newRoutes;
routes.value = constantRoutes.concat(newRoutes);
@ -108,7 +118,20 @@ export const usePermissionStore = defineStore('permission', () => {
});
return children;
};
return { routes, setRoutes, generateRoutes, setSidebarRouters, topbarRouters, sidebarRouters, defaultRoutes };
return {
routes,
topbarRouters,
sidebarRouters,
defaultRoutes,
getRoutes,
getSidebarRoutes,
getTopbarRoutes,
setRoutes,
generateRoutes,
setSidebarRouters
};
});
// 动态路由遍历,验证是否具备权限

View File

@ -1,38 +1,53 @@
import { TagView, RouteRecordNormalized, RouteLocationNormalized } from 'vue-router';
import { RouteLocationNormalized } from 'vue-router';
export const useTagsViewStore = defineStore('tagsView', () => {
const visitedViews = ref<TagView[]>([]);
const visitedViews = ref<RouteLocationNormalized[]>([]);
const cachedViews = ref<string[]>([]);
const iframeViews = ref<TagView[]>([]);
const iframeViews = ref<RouteLocationNormalized[]>([]);
const addView = (view: TagView) => {
const getVisitedViews = (): RouteLocationNormalized[] => {
return visitedViews.value;
};
const getIframeViews = (): RouteLocationNormalized[] => {
return iframeViews.value;
};
const getCachedViews = (): string[] => {
return cachedViews.value;
};
const addView = (view: RouteLocationNormalized) => {
addVisitedView(view);
addCachedView(view);
};
const addIframeView = (view: TagView): void => {
if (iframeViews.value.some((v: TagView) => v.path === view.path)) return;
const addIframeView = (view: RouteLocationNormalized): void => {
if (iframeViews.value.some((v: RouteLocationNormalized) => v.path === view.path)) return;
iframeViews.value.push(
Object.assign({}, view, {
title: view.meta?.title || 'no-name'
})
);
};
const delIframeView = (view: TagView): Promise<TagView[]> => {
const delIframeView = (view: RouteLocationNormalized): Promise<RouteLocationNormalized[]> => {
return new Promise((resolve) => {
iframeViews.value = iframeViews.value.filter((item: TagView) => item.path !== view.path);
iframeViews.value = iframeViews.value.filter((item: RouteLocationNormalized) => item.path !== view.path);
resolve([...iframeViews.value]);
});
};
const addVisitedView = (view: TagView): void => {
if (visitedViews.value.some((v: TagView) => v.path === view.path)) return;
const addVisitedView = (view: RouteLocationNormalized): void => {
if (visitedViews.value.some((v: RouteLocationNormalized) => v.path === view.path)) return;
visitedViews.value.push(
Object.assign({}, view, {
title: view.meta?.title || 'no-name'
})
);
};
const delView = (view: TagView): Promise<{ visitedViews: TagView[]; cachedViews: string[] }> => {
const delView = (
view: RouteLocationNormalized
): Promise<{
visitedViews: RouteLocationNormalized[];
cachedViews: string[];
}> => {
return new Promise((resolve) => {
delVisitedView(view);
if (!isDynamicRoute(view)) {
@ -45,7 +60,7 @@ export const useTagsViewStore = defineStore('tagsView', () => {
});
};
const delVisitedView = (view: TagView): Promise<TagView[]> => {
const delVisitedView = (view: RouteLocationNormalized): Promise<RouteLocationNormalized[]> => {
return new Promise((resolve) => {
for (const [i, v] of visitedViews.value.entries()) {
if (v.path === view.path) {
@ -56,7 +71,7 @@ export const useTagsViewStore = defineStore('tagsView', () => {
resolve([...visitedViews.value]);
});
};
const delCachedView = (view?: TagView): Promise<string[]> => {
const delCachedView = (view?: RouteLocationNormalized): Promise<string[]> => {
let viewName = '';
if (view) {
viewName = view.name as string;
@ -67,7 +82,12 @@ export const useTagsViewStore = defineStore('tagsView', () => {
resolve([...cachedViews.value]);
});
};
const delOthersViews = (view: TagView): Promise<{ visitedViews: TagView[]; cachedViews: string[] }> => {
const delOthersViews = (
view: RouteLocationNormalized
): Promise<{
visitedViews: RouteLocationNormalized[];
cachedViews: string[];
}> => {
return new Promise((resolve) => {
delOthersVisitedViews(view);
delOthersCachedViews(view);
@ -78,15 +98,15 @@ export const useTagsViewStore = defineStore('tagsView', () => {
});
};
const delOthersVisitedViews = (view: TagView): Promise<TagView[]> => {
const delOthersVisitedViews = (view: RouteLocationNormalized): Promise<RouteLocationNormalized[]> => {
return new Promise((resolve) => {
visitedViews.value = visitedViews.value.filter((v: TagView) => {
visitedViews.value = visitedViews.value.filter((v: RouteLocationNormalized) => {
return v.meta?.affix || v.path === view.path;
});
resolve([...visitedViews.value]);
});
};
const delOthersCachedViews = (view: TagView): Promise<string[]> => {
const delOthersCachedViews = (view: RouteLocationNormalized): Promise<string[]> => {
const viewName = view.name as string;
return new Promise((resolve) => {
const index = cachedViews.value.indexOf(viewName);
@ -99,7 +119,7 @@ export const useTagsViewStore = defineStore('tagsView', () => {
});
};
const delAllViews = (): Promise<{ visitedViews: TagView[]; cachedViews: string[] }> => {
const delAllViews = (): Promise<{ visitedViews: RouteLocationNormalized[]; cachedViews: string[] }> => {
return new Promise((resolve) => {
delAllVisitedViews();
delAllCachedViews();
@ -109,9 +129,9 @@ export const useTagsViewStore = defineStore('tagsView', () => {
});
});
};
const delAllVisitedViews = (): Promise<TagView[]> => {
const delAllVisitedViews = (): Promise<RouteLocationNormalized[]> => {
return new Promise((resolve) => {
visitedViews.value = visitedViews.value.filter((tag: TagView) => tag.meta?.affix);
visitedViews.value = visitedViews.value.filter((tag: RouteLocationNormalized) => tag.meta?.affix);
resolve([...visitedViews.value]);
});
};
@ -123,7 +143,7 @@ export const useTagsViewStore = defineStore('tagsView', () => {
});
};
const updateVisitedView = (view: TagView): void => {
const updateVisitedView = (view: RouteLocationNormalized): void => {
for (let v of visitedViews.value) {
if (v.path === view.path) {
v = Object.assign(v, view);
@ -131,13 +151,13 @@ export const useTagsViewStore = defineStore('tagsView', () => {
}
}
};
const delRightTags = (view: TagView): Promise<TagView[]> => {
const delRightTags = (view: RouteLocationNormalized): Promise<RouteLocationNormalized[]> => {
return new Promise((resolve) => {
const index = visitedViews.value.findIndex((v: TagView) => v.path === view.path);
const index = visitedViews.value.findIndex((v: RouteLocationNormalized) => v.path === view.path);
if (index === -1) {
return;
}
visitedViews.value = visitedViews.value.filter((item: TagView, idx: number) => {
visitedViews.value = visitedViews.value.filter((item: RouteLocationNormalized, idx: number) => {
if (idx <= index || (item.meta && item.meta.affix)) {
return true;
}
@ -150,13 +170,13 @@ export const useTagsViewStore = defineStore('tagsView', () => {
resolve([...visitedViews.value]);
});
};
const delLeftTags = (view: TagView): Promise<TagView[]> => {
const delLeftTags = (view: RouteLocationNormalized): Promise<RouteLocationNormalized[]> => {
return new Promise((resolve) => {
const index = visitedViews.value.findIndex((v: TagView) => v.path === view.path);
const index = visitedViews.value.findIndex((v: RouteLocationNormalized) => v.path === view.path);
if (index === -1) {
return;
}
visitedViews.value = visitedViews.value.filter((item: TagView, idx: number) => {
visitedViews.value = visitedViews.value.filter((item: RouteLocationNormalized, idx: number) => {
if (idx >= index || (item.meta && item.meta.affix)) {
return true;
}
@ -170,7 +190,7 @@ export const useTagsViewStore = defineStore('tagsView', () => {
});
};
const addCachedView = (view: TagView): void => {
const addCachedView = (view: RouteLocationNormalized): void => {
const viewName = view.name as string;
if (!viewName) return;
if (cachedViews.value.includes(viewName)) return;
@ -179,15 +199,20 @@ export const useTagsViewStore = defineStore('tagsView', () => {
}
};
const isDynamicRoute = (view: any): boolean => {
const isDynamicRoute = (view: RouteLocationNormalized): boolean => {
// 检查匹配的路由记录中是否有动态段
return view.matched.some((m: RouteRecordNormalized) => m.path.includes(':'));
return view.matched.some((m) => m.path.includes(':'));
};
return {
visitedViews,
cachedViews,
iframeViews,
getVisitedViews,
getIframeViews,
getCachedViews,
addVisitedView,
addCachedView,
delVisitedView,
@ -205,5 +230,4 @@ export const useTagsViewStore = defineStore('tagsView', () => {
delIframeView
};
});
export default useTagsViewStore;

View File

@ -1,9 +1,9 @@
import { to } from 'await-to-js';
import defAva from '@/assets/images/profile.jpg';
import store from '@/store';
import { getToken, removeToken, setToken } from '@/utils/auth';
import { login as loginApi, logout as logoutApi, getInfo as getUserInfo } from '@/api/login';
import { LoginData } from '@/api/types';
import defAva from '@/assets/images/profile.jpg';
import store from '@/store';
export const useUserStore = defineStore('user', () => {
const token = ref(getToken());

View File

@ -1,6 +1,6 @@
import type * as ep from 'element-plus';
declare global {
declare type ElTagType = '' | 'success' | 'warning' | 'info' | 'danger' | 'default' | 'primary';
declare type ElTagType = 'success' | 'info' | 'warning' | 'danger' | '';
declare type ElFormInstance = ep.FormInstance;
declare type ElTableInstance = ep.TableInstance;
declare type ElUploadInstance = ep.UploadInstance;
@ -32,5 +32,4 @@ declare global {
declare type ElFormRules = ep.FormRules;
declare type DateModelType = ep.DateModelType;
declare type UploadFile = ep.UploadFile;
}

View File

@ -22,6 +22,7 @@ declare module 'vue-router' {
interface _RouteLocationBase {
children?: _RouteRecordBase[];
path?: string;
title?: string;
}
interface TagView {
@ -33,3 +34,5 @@ declare module 'vue-router' {
query?: LocationQuery;
}
}
export {};

View File

@ -131,6 +131,7 @@ import { optionselect as getDictOptionselect, getType } from '@/api/system/dict/
import { listData, getData, delData, addData, updateData } from '@/api/system/dict/data';
import { DictTypeVO } from '@/api/system/dict/type/types';
import { DictDataForm, DictDataQuery, DictDataVO } from '@/api/system/dict/data/types';
import { RouteLocationNormalized } from 'vue-router';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const route = useRoute();
@ -168,7 +169,7 @@ const initFormData: DictDataForm = {
dictLabel: '',
dictValue: '',
cssClass: '',
listClass: 'default',
listClass: '',
dictSort: 0,
remark: ''
};
@ -228,7 +229,17 @@ const handleQuery = () => {
};
/** 返回按钮操作 */
const handleClose = () => {
const obj = { path: '/system/dict' };
const obj: RouteLocationNormalized = {
fullPath: '',
hash: '',
matched: [],
meta: undefined,
name: undefined,
params: undefined,
query: undefined,
redirectedFrom: undefined,
path: '/system/dict'
};
proxy?.$tab.closeOpenPage(obj);
};
/** 重置按钮操作 */

View File

@ -69,6 +69,7 @@ import { allocatedUserList, authUserCancel, authUserCancelAll } from '@/api/syst
import { UserQuery } from '@/api/system/user/types';
import { UserVO } from '@/api/system/user/types';
import SelectUser from './selectUser.vue';
import { RouteLocationNormalized } from 'vue-router';
const route = useRoute();
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
@ -102,7 +103,17 @@ const getList = async () => {
};
//
const handleClose = () => {
const obj = { path: '/system/role' };
const obj: RouteLocationNormalized = {
path: '/system/role',
fullPath: '',
hash: '',
matched: [],
meta: undefined,
name: undefined,
params: undefined,
query: undefined,
redirectedFrom: undefined
};
proxy?.$tab.closeOpenPage(obj);
};
/** 搜索按钮操作 */

View File

@ -58,6 +58,7 @@
import { RoleVO } from '@/api/system/role/types';
import { getAuthRole, updateAuthRole } from '@/api/system/user';
import { UserForm } from '@/api/system/user/types';
import { RouteLocationNormalized } from 'vue-router';
const route = useRoute();
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
@ -91,7 +92,17 @@ const getRowKey = (row: RoleVO): string => {
};
/** 关闭按钮 */
const close = () => {
const obj = { path: '/system/user' };
const obj: RouteLocationNormalized = {
fullPath: '',
hash: '',
matched: [],
meta: undefined,
name: undefined,
params: undefined,
query: undefined,
redirectedFrom: undefined,
path: '/system/user'
};
proxy?.$tab.closeOpenPage(obj);
};
/** 提交按钮 */

View File

@ -119,6 +119,7 @@ import { optionselect as getDictOptionselect } from '@/api/system/dict/type';
import { DictTypeVO } from '@/api/system/dict/type/types';
import BasicInfoForm from './basicInfoForm.vue';
import GenInfoForm from './genInfoForm.vue';
import { RouteLocationNormalized } from 'vue-router';
const route = useRoute();
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
@ -167,7 +168,17 @@ const getFormPromise = (form: any) => {
});
};
const close = () => {
const obj = { path: '/tool/gen', query: { t: Date.now(), pageNum: route.query.pageNum } };
const obj: RouteLocationNormalized = {
path: '/tool/gen',
fullPath: '',
hash: '',
matched: [],
meta: undefined,
name: undefined,
params: undefined,
redirectedFrom: undefined,
query: { t: Date.now().toString(), pageNum: route.query.pageNum }
};
proxy?.$tab.closeOpenPage(obj);
};

View File

@ -143,7 +143,10 @@ const queryParams = ref<TableQuery>({
dataName: ''
});
const preview = ref<any>({
const preview = ref<{
data: Record<string, string>;
activeName: string;
}>({
data: {},
activeName: 'domain.java'
});