Merge branch 'dev' into future/flowable

This commit is contained in:
songgaoshuai 2023-12-29 15:15:49 +08:00
commit cf5a083856
35 changed files with 254 additions and 128 deletions

View File

@ -57,7 +57,8 @@
"@unocss/preset-attributify": "^0.58.0",
"@unocss/preset-icons": "^0.58.0",
"@unocss/preset-uno": "^0.58.0",
"@vue/compiler-sfc": "3.3.9",
"@vue/compiler-sfc": "3.3.11",
"@vue/runtime-core": "3.3.11",
"@vitejs/plugin-vue": "4.5.2",
"autoprefixer": "10.4.14",
"eslint": "8.55.0",

View File

@ -64,12 +64,12 @@ export const delClient = (id: string | number | Array<string | number>) => {
/**
*
* @param id ID
* @param clientId id
* @param status
*/
export function changeStatus(id: number | string, status: string) {
export function changeStatus(clientId: string, status: string) {
const data = {
id,
clientId,
status
};
return request({

View File

@ -7,7 +7,7 @@ export interface ClientVO {
/**
* id
*/
clientId: string | number;
clientId: string;
/**
* key

View File

@ -29,11 +29,13 @@
</template>
<script setup lang="ts">
import { propTypes } from '@/utils/propTypes';
interface Props {
options: Array<DictDataOption>;
value: number | string | Array<number | string>;
showValue: boolean;
separator: string;
showValue?: boolean;
separator?: string;
}
const props = withDefaults(defineProps<Props>(), {
showValue: true,

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

@ -126,7 +126,7 @@ const toggleDark = () => useToggle(isDark);
const topNavChange = (val: any) => {
if (!val) {
appStore.toggleSideBarHide(false);
permissionStore.setSidebarRouters(permissionStore.defaultRoutes);
permissionStore.setSidebarRouters(permissionStore.defaultRoutes as any);
}
};

View File

@ -13,7 +13,7 @@
:collapse-transition="false"
mode="vertical"
>
<sidebar-item v-for="(r, index) in sidebarRouters" :key="r.path + index" :item="r" :base-path="r.path" />
<sidebar-item v-for="(route, index) in sidebarRouters" :key="route.path + index" :item="route" :base-path="route.path" />
</el-menu>
</transition>
</el-scrollbar>
@ -29,13 +29,13 @@ import useSettingsStore from '@/store/modules/settings';
import usePermissionStore from '@/store/modules/permission';
import { RouteRecordRaw } from 'vue-router';
const { proxy } = getCurrentInstance();
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
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

@ -54,7 +54,7 @@ const state = reactive<SearchState>({
const openSearch = () => {
state.menuQuery = '';
state.isShowSearch = true;
state.menuList = generateRoutes(routes.value);
state.menuList = generateRoutes(routes.value as any);
nextTick(() => {
setTimeout(() => {
layoutMenuAutocompleteRef.value.focus();

View File

@ -40,8 +40,6 @@ router.beforeEach(async (to, from, next) => {
router.addRoute(route); // 动态添加可访问路由表
}
});
const n = { ...to, replace: true };
console.log(n);
next({ path: to.path, replace: true, params: to.params, query: to.query, hash: to.hash, name: to.name as string }); // hack方法 确保addRoutes已完成
}
} else {

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,5 +1,4 @@
import axios from 'axios';
export {};
declare module 'axios' {
interface AxiosResponse<T = any> {
code: number;

View File

@ -1,34 +1,35 @@
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;
declare type ElScrollbarInstance = ep.ScrollbarInstance;
declare type ElInputInstance = ep.InputInstance;
declare type ElInputNumberInstance = ep.InputNumberInstance;
declare type ElRadioInstance = ep.RadioInstance;
declare type ElRadioGroupInstance = ep.RadioGroupInstance;
declare type ElRadioButtonInstance = ep.RadioButtonInstance;
declare type ElCheckboxInstance = ep.CheckboxInstance;
declare type ElSwitchInstance = ep.SwitchInstance;
declare type ElCascaderInstance = ep.CascaderInstance;
declare type ElColorPickerInstance = ep.ColorPickerInstance;
declare type ElRateInstance = ep.RateInstance;
declare type ElSliderInstance = ep.SliderInstance;
declare type ElTreeInstance = InstanceType<typeof ep.ElTree>;
declare type ElTreeSelectInstance = InstanceType<typeof ep.ElTreeSelect>;
declare type ElSelectInstance = InstanceType<typeof ep.ElSelect>;
declare type ElCardInstance = InstanceType<typeof ep.ElCard>;
declare type ElDialogInstance = InstanceType<typeof ep.ElDialog>;
declare type ElInputInstance = InstanceType<typeof ep.ElInput>;
declare type ElInputNumberInstance = InstanceType<typeof ep.ElInputNumber>;
declare type ElRadioInstance = InstanceType<typeof ep.ElRadio>;
declare type ElRadioGroupInstance = InstanceType<typeof ep.ElRadioGroup>;
declare type ElRadioButtonInstance = InstanceType<typeof ep.ElRadioButton>;
declare type ElCheckboxInstance = InstanceType<typeof ep.ElCheckbox>;
declare type ElCheckboxGroupInstance = InstanceType<typeof ep.ElCheckboxGroup>;
declare type ElSwitchInstance = InstanceType<typeof ep.ElSwitch>;
declare type ElDatePickerInstance = InstanceType<typeof ep.ElDatePicker>;
declare type ElTimePickerInstance = InstanceType<typeof ep.ElTimePicker>;
declare type ElTimeSelectInstance = InstanceType<typeof ep.ElTimeSelect>;
declare type ElCascaderInstance = InstanceType<typeof ep.ElCascader>;
declare type ElColorPickerInstance = InstanceType<typeof ep.ElColorPicker>;
declare type ElRateInstance = InstanceType<typeof ep.ElRate>;
declare type ElSliderInstance = InstanceType<typeof ep.ElSlider>;
declare type TransferKey = ep.TransferKey;
declare type CheckboxValueType = ep.CheckboxValueType;
declare type ElFormRules = ep.FormRules;
declare type DateModelType = ep.DateModelType;
declare type UploadFile = typeof ep.UploadFile;
declare type UploadFile = ep.UploadFile;
}

View File

@ -1,5 +1,4 @@
import type { ComponentInternalInstance as ComponentInstance } from 'vue/runtime-core';
import type { PropType as VuePropType } from 'vue';
import type { PropType as VuePropType, ComponentInternalInstance as ComponentInstance } from 'vue';
import { LanguageEnum } from '@/enums/LanguageEnum';
declare global {

View File

@ -5,10 +5,12 @@ import auth from '@/plugins/auth';
import cache from '@/plugins/cache';
import animate from '@/animate';
import { useDict } from '@/utils/dict';
import handleTree, { addDateRange, selectDictLabel, selectDictLabels, parseTime } from '@/utils/ruoyi';
import { handleTree, addDateRange, selectDictLabel, selectDictLabels, parseTime } from '@/utils/ruoyi';
import { getConfigKey, updateConfigByKey } from '@/api/system/config';
import { download as rd } from '@/utils/request';
export {};
declare module '@vue/runtime-core' {
interface ComponentCustomProperties {
// 全局方法声明

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

@ -126,8 +126,9 @@
<script setup name="Cache" lang="ts">
import { getCache } from '@/api/monitor/cache';
import * as echarts from 'echarts';
import { CacheVO } from '@/api/monitor/cache/types';
const cache = ref<any>({});
const cache = ref<Partial<CacheVO>>({});
const commandstats = ref();
const usedmemory = ref();
const { proxy } = getCurrentInstance() as ComponentInternalInstance;

View File

@ -303,7 +303,7 @@ const handleStatusChange = async (row: ClientVO) => {
let text = row.status === '0' ? '启用' : '停用';
try {
await proxy?.$modal.confirm('确认要"' + text + '"吗?');
await changeStatus(row.id, row.status);
await changeStatus(row.clientId, row.status);
proxy?.$modal.msgSuccess(text + '成功');
} catch (err) {
row.status = row.status === '0' ? '1' : '0';

View File

@ -172,7 +172,7 @@ const initFormData: DeptForm = {
email: undefined,
status: '0'
};
const data = reactive<PageData<DeptForm, DeptQuery>>({
const initData: PageData<DeptForm, DeptQuery> = {
form: { ...initFormData },
queryParams: {
pageNum: 1,
@ -187,7 +187,8 @@ const data = reactive<PageData<DeptForm, DeptQuery>>({
email: [{ type: 'email', message: '请输入正确的邮箱地址', trigger: ['blur', 'change'] }],
phone: [{ pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, message: '请输入正确的手机号码', trigger: 'blur' }]
}
});
};
const data = reactive<PageData<DeptForm, DeptQuery>>(initData);
const { queryParams, form, rules } = toRefs<PageData<DeptForm, DeptQuery>>(data);

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

@ -306,7 +306,7 @@ import { to } from 'await-to-js';
import { globalHeaders } from '@/utils/request';
const router = useRouter();
const { proxy } = getCurrentInstance();
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { sys_normal_disable, sys_user_sex } = toRefs<any>(proxy?.useDict('sys_normal_disable', 'sys_user_sex'));
const userList = ref<UserVO[]>();
const loading = ref(true);

View File

@ -27,7 +27,7 @@
</li>
<li class="list-group-item">
<svg-icon icon-class="tree" />所属部门
<div v-if="state.user.dept" class="pull-right">{{ state.user.dept.deptName }} / {{ state.postGroup }}</div>
<div v-if="state.user.dept" class="pull-right">{{ state.user.dept?.deptName }} / {{ state.postGroup }}</div>
</li>
<li class="list-group-item">
<svg-icon icon-class="peoples" />所属角色
@ -72,9 +72,16 @@ import ResetPwd from './resetPwd.vue';
import ThirdParty from './thirdParty.vue';
import { getAuthList } from '@/api/system/social/auth';
import { getUserProfile } from '@/api/system/user';
import { UserVO } from '@/api/system/user/types';
const activeTab = ref('userinfo');
const state = ref<Record<string, any>>({
interface State {
user: Partial<UserVO>;
roleGroup: string;
postGroup: string;
auths: any;
}
const state = ref<State>({
user: {},
roleGroup: '',
postGroup: '',

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'
});

View File

@ -4,8 +4,9 @@
"module": "esnext",
// "useDefineForClassFields": true,
"moduleResolution": "bundler",
"strict": false,
"strict": true,
"jsx": "preserve",
"strictNullChecks": false,
"sourceMap": true,
"resolveJsonModule": true,
"esModuleInterop": true,