diff --git a/package.json b/package.json
index 7995d93..f1c8084 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "ruoyi-vue-plus",
- "version": "5.2.0",
+ "version": "5.2.1",
"description": "RuoYi-Vue-Plus多租户管理系统",
"author": "LionLi",
"license": "MIT",
diff --git a/src/api/workflow/formManage/index.ts b/src/api/workflow/formManage/index.ts
index c2930cf..6c5ec60 100644
--- a/src/api/workflow/formManage/index.ts
+++ b/src/api/workflow/formManage/index.ts
@@ -25,7 +25,7 @@ export const listFormManage = (query?: FormManageQuery): AxiosPromise => {
return request({
url: '/workflow/formManage/list/selectList',
- method: 'get',
+ method: 'get'
});
};
diff --git a/src/api/workflow/formManage/types.ts b/src/api/workflow/formManage/types.ts
index 6554f55..b9dc1d8 100644
--- a/src/api/workflow/formManage/types.ts
+++ b/src/api/workflow/formManage/types.ts
@@ -26,7 +26,7 @@ export interface FormManageVO {
/**
* 备注
*/
- remork: string;
+ remark: string;
}
export interface FormManageForm extends BaseEntity {
@@ -53,7 +53,7 @@ export interface FormManageForm extends BaseEntity {
/**
* 备注
*/
- remork?: string;
+ remark?: string;
}
export interface FormManageQuery extends PageQuery {
diff --git a/src/api/workflow/model/index.ts b/src/api/workflow/model/index.ts
index 56f7fed..1ca8b19 100644
--- a/src/api/workflow/model/index.ts
+++ b/src/api/workflow/model/index.ts
@@ -22,7 +22,7 @@ export const listModel = (query: ModelQuery): AxiosPromise => {
*/
export const getInfo = (id: string): AxiosPromise => {
return request({
- url: '/workflow/model/getInfo/'+id,
+ url: '/workflow/model/getInfo/' + id,
method: 'get'
});
};
@@ -101,4 +101,4 @@ export const copyModel = (data: ModelForm): AxiosPromise => {
method: 'post',
data: data
});
-};
\ No newline at end of file
+};
diff --git a/src/api/workflow/model/types.ts b/src/api/workflow/model/types.ts
index 40a0faa..77f947d 100644
--- a/src/api/workflow/model/types.ts
+++ b/src/api/workflow/model/types.ts
@@ -1,10 +1,10 @@
export interface ModelForm {
- id: string,
+ id: string;
name: string;
key: string;
categoryCode: string;
- xml:string,
- svg:string,
+ xml: string;
+ svg: string;
description: string;
}
diff --git a/src/api/workflow/nodeConfig/types.ts b/src/api/workflow/nodeConfig/types.ts
index 4e3a60b..a55fc91 100644
--- a/src/api/workflow/nodeConfig/types.ts
+++ b/src/api/workflow/nodeConfig/types.ts
@@ -35,9 +35,4 @@ export interface NodeConfigVO {
* 表单管理
*/
wfFormManageVo: FormManageVO;
-
}
-
-
-
-
diff --git a/src/bpmn/assets/module/ContextPad/CustomContextPadProvider.ts b/src/bpmn/assets/module/ContextPad/CustomContextPadProvider.ts
index 9f12ff2..13ccf50 100644
--- a/src/bpmn/assets/module/ContextPad/CustomContextPadProvider.ts
+++ b/src/bpmn/assets/module/ContextPad/CustomContextPadProvider.ts
@@ -40,7 +40,7 @@ class CustomContextPadProvider extends ContextPadProvider {
rules: Rules,
translate
) {
- // @ts-ignore
+ // @ts-expect-error 忽略异常
super(config, injector, eventBus, contextPad, modeling, elementFactory, connect, create, popupMenu, canvas, rules, translate);
this._contextPad = contextPad;
diff --git a/src/components/Editor/index.vue b/src/components/Editor/index.vue
index fc30c85..ba70fbb 100644
--- a/src/components/Editor/index.vue
+++ b/src/components/Editor/index.vue
@@ -110,7 +110,7 @@ watch(
() => props.modelValue,
(v: string) => {
if (v !== content.value) {
- content.value = v === undefined ? '' : v;
+ content.value = v || '';
}
},
{ immediate: true }
diff --git a/src/components/ImagePreview/index.vue b/src/components/ImagePreview/index.vue
index 349f729..98e6479 100644
--- a/src/components/ImagePreview/index.vue
+++ b/src/components/ImagePreview/index.vue
@@ -38,7 +38,7 @@ const realSrcList = computed(() => {
let real_src_list = props.src.split(',');
let srcList: string[] = [];
real_src_list.forEach((item: string) => {
- if(item.trim() === '') {
+ if (item.trim() === '') {
return;
}
return srcList.push(item);
diff --git a/src/components/Process/multiInstanceUser.vue b/src/components/Process/multiInstanceUser.vue
index 292b1b7..d19fb5f 100644
--- a/src/components/Process/multiInstanceUser.vue
+++ b/src/components/Process/multiInstanceUser.vue
@@ -128,7 +128,7 @@ const props = defineProps({
//回显用户id
userIdList: {
type: Array,
- default: []
+ default: () => []
}
});
const deptTreeRef = ref(ElTree);
diff --git a/src/components/Process/submitVerify.vue b/src/components/Process/submitVerify.vue
index bcbc657..09fc82e 100644
--- a/src/components/Process/submitVerify.vue
+++ b/src/components/Process/submitVerify.vue
@@ -106,7 +106,7 @@ const multiInstanceUserRef = ref>();
const props = defineProps({
taskVariables: {
type: Object as () => Record,
- default: {}
+ default: () => {}
}
});
//遮罩层
diff --git a/src/components/UserSelect/index.vue b/src/components/UserSelect/index.vue
index f6e552e..e9865e5 100644
--- a/src/components/UserSelect/index.vue
+++ b/src/components/UserSelect/index.vue
@@ -29,16 +29,11 @@
-
+
搜索
- 重置
+ resetQuery()">重置
@@ -223,13 +218,13 @@ const handleQuery = () => {
getList();
};
/** 重置按钮操作 */
-const resetQuery = () => {
+const resetQuery = (refresh = true) => {
dateRange.value = ['', ''];
queryFormRef.value?.resetFields();
queryParams.value.pageNum = 1;
queryParams.value.deptId = undefined;
deptTreeRef.value?.setCurrentKey(undefined);
- handleQuery();
+ refresh && handleQuery();
};
const handleCheckboxChange = (checked) => {
@@ -288,23 +283,20 @@ const close = () => {
watch(
() => userDialog.visible.value,
- (newValue: boolean) => {
+ async (newValue: boolean) => {
if (newValue) {
- initSelectUser();
+ await getTreeSelect(); // 初始化部门数据
+ await getList(); // 初始化列表数据
+ await initSelectUser();
} else {
tableRef.value.clearCheckboxReserve();
tableRef.value.clearCheckboxRow();
- resetQuery();
+ resetQuery(false);
selectUserList.value = [];
}
}
);
-onMounted(() => {
- getTreeSelect(); // 初始化部门数据
- getList(); // 初始化列表数据
-});
-
defineExpose({
open: userDialog.openDialog,
close: userDialog.closeDialog
diff --git a/src/hooks/useDialog.ts b/src/hooks/useDialog.ts
index 68440bf..547f199 100644
--- a/src/hooks/useDialog.ts
+++ b/src/hooks/useDialog.ts
@@ -28,4 +28,4 @@ export default (ops?: Options): Return => {
openDialog,
closeDialog
};
-};
\ No newline at end of file
+};
diff --git a/src/layout/components/AppMain.vue b/src/layout/components/AppMain.vue
index d634935..7f86ef4 100644
--- a/src/layout/components/AppMain.vue
+++ b/src/layout/components/AppMain.vue
@@ -1,13 +1,13 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
diff --git a/src/layout/components/SocialCallback/index.vue b/src/layout/components/SocialCallback/index.vue
index de65aed..746de20 100644
--- a/src/layout/components/SocialCallback/index.vue
+++ b/src/layout/components/SocialCallback/index.vue
@@ -18,7 +18,7 @@ const code = route.query.code as string;
const state = route.query.state as string;
const source = route.query.source as string;
const stateJson = JSON.parse(atob(state));
-const tenantId = stateJson.tenantId as string ? stateJson.tenantId as string : '000000';
+const tenantId = (stateJson.tenantId as string) ? (stateJson.tenantId as string) : '000000';
const domain = stateJson.domain as string;
const processResponse = async (res: any) => {
diff --git a/src/permission.ts b/src/permission.ts
index 1123738..6771f8c 100644
--- a/src/permission.ts
+++ b/src/permission.ts
@@ -53,7 +53,7 @@ router.beforeEach(async (to, from, next) => {
next();
} else {
const redirect = encodeURIComponent(to.fullPath || '/');
- next(`/login?redirect=${redirect}`) // 否则全部重定向到登录页
+ next(`/login?redirect=${redirect}`); // 否则全部重定向到登录页
NProgress.done();
}
}
diff --git a/src/store/modules/permission.ts b/src/store/modules/permission.ts
index cf12a73..2e719ba 100644
--- a/src/store/modules/permission.ts
+++ b/src/store/modules/permission.ts
@@ -9,6 +9,8 @@ import Layout from '@/layout/index.vue';
import ParentView from '@/components/ParentView/index.vue';
import InnerLink from '@/layout/components/InnerLink/index.vue';
+import { createCustomNameComponent } from '@/utils/createCustomNameComponent';
+
// 匹配views里面所有的.vue文件
const modules = import.meta.glob('./../../views/**/*.vue');
export const usePermissionStore = defineStore('permission', () => {
@@ -58,6 +60,8 @@ export const usePermissionStore = defineStore('permission', () => {
setSidebarRouters(constantRoutes.concat(sidebarRoutes));
setDefaultRoutes(sidebarRoutes);
setTopbarRoutes(defaultRoutes);
+ // 路由name重复检查
+ duplicateRouteChecker(asyncRoutes, sidebarRoutes);
return new Promise((resolve) => resolve(rewriteRoutes));
};
@@ -80,7 +84,7 @@ export const usePermissionStore = defineStore('permission', () => {
} else if (route.component?.toString() === 'InnerLink') {
route.component = InnerLink;
} else {
- route.component = loadView(route.component);
+ route.component = loadView(route.component, route.name as string);
}
if (route.children != null && route.children && route.children.length) {
route.children = filterAsyncRouter(route.children, route, type);
@@ -151,12 +155,12 @@ export const filterDynamicRoutes = (routes: RouteRecordRaw[]) => {
return res;
};
-export const loadView = (view: any) => {
+export const loadView = (view: any, name: string) => {
let res;
for (const path in modules) {
const dir = path.split('views/')[1].split('.vue')[0];
if (dir === view) {
- res = () => modules[path]();
+ res = createCustomNameComponent(modules[path], { name });
}
}
return res;
@@ -167,4 +171,48 @@ export const usePermissionStoreHook = () => {
return usePermissionStore(store);
};
+interface Route {
+ name?: string | symbol;
+ path: string;
+ children?: Route[];
+}
+
+/**
+ * 检查路由name是否重复
+ * @param localRoutes 本地路由
+ * @param routes 动态路由
+ */
+function duplicateRouteChecker(localRoutes: Route[], routes: Route[]) {
+ // 展平
+ function flatRoutes(routes: Route[]) {
+ const res: Route[] = [];
+ routes.forEach((route) => {
+ if (route.children) {
+ res.push(...flatRoutes(route.children));
+ } else {
+ res.push(route);
+ }
+ });
+ return res;
+ }
+
+ const allRoutes = flatRoutes([...localRoutes, ...routes]);
+
+ const nameList: string[] = [];
+ allRoutes.forEach((route) => {
+ const name = route.name.toString();
+ if (name && nameList.includes(name)) {
+ const message = `路由名称: [${name}] 重复, 会造成 404`;
+ console.error(message);
+ ElNotification({
+ title: '路由名称重复',
+ message,
+ type: 'error'
+ });
+ return;
+ }
+ nameList.push(route.name.toString());
+ });
+}
+
export default usePermissionStore;
diff --git a/src/utils/createCustomNameComponent.tsx b/src/utils/createCustomNameComponent.tsx
new file mode 100644
index 0000000..daf5866
--- /dev/null
+++ b/src/utils/createCustomNameComponent.tsx
@@ -0,0 +1,39 @@
+/**
+ * 后台返回的路由动态生成name 解决缓存问题
+ * 感谢 @fourteendp
+ * 详见 https://github.com/vbenjs/vue-vben-admin/issues/3927
+ */
+import { Component, defineComponent, h } from 'vue';
+
+interface Options {
+ name?: string;
+}
+
+export function createCustomNameComponent(loader: () => Promise, options: Options = {}): () => Promise {
+ const { name } = options;
+ let component: Component | null = null;
+
+ const load = async () => {
+ try {
+ const { default: loadedComponent } = await loader();
+ component = loadedComponent;
+ } catch (error) {
+ console.error(`Cannot resolve component ${name}, error:`, error);
+ }
+ };
+
+ return async () => {
+ if (!component) {
+ await load();
+ }
+
+ return Promise.resolve(
+ defineComponent({
+ name,
+ render() {
+ return h(component as Component);
+ }
+ })
+ );
+ };
+}
diff --git a/src/views/index.vue b/src/views/index.vue
index d384909..aa60a9b 100644
--- a/src/views/index.vue
+++ b/src/views/index.vue
@@ -33,7 +33,7 @@
* 部署方式 Docker 容器编排 一键部署业务集群
* 国际化 SpringMessage Spring标准国际化方案
- 当前版本: v5.2.0
+ 当前版本: v5.2.1
¥免费开源
diff --git a/src/views/monitor/logininfor/index.vue b/src/views/monitor/logininfor/index.vue
index 27c0a85..03d0d8f 100644
--- a/src/views/monitor/logininfor/index.vue
+++ b/src/views/monitor/logininfor/index.vue
@@ -11,7 +11,7 @@
-
+
diff --git a/src/views/monitor/operlog/index.vue b/src/views/monitor/operlog/index.vue
index 1442984..ed0d755 100644
--- a/src/views/monitor/operlog/index.vue
+++ b/src/views/monitor/operlog/index.vue
@@ -14,12 +14,12 @@
-
+
-
+
diff --git a/src/views/system/client/index.vue b/src/views/system/client/index.vue
index af8696b..c05dcdc 100644
--- a/src/views/system/client/index.vue
+++ b/src/views/system/client/index.vue
@@ -10,7 +10,7 @@
-
+
diff --git a/src/views/system/config/index.vue b/src/views/system/config/index.vue
index 138068e..1b67d48 100644
--- a/src/views/system/config/index.vue
+++ b/src/views/system/config/index.vue
@@ -11,7 +11,7 @@
-
+
diff --git a/src/views/system/dept/index.vue b/src/views/system/dept/index.vue
index 71aeff1..199a997 100644
--- a/src/views/system/dept/index.vue
+++ b/src/views/system/dept/index.vue
@@ -11,7 +11,7 @@
-
+
diff --git a/src/views/system/menu/index.vue b/src/views/system/menu/index.vue
index 9e5b5c3..cf5f0fc 100644
--- a/src/views/system/menu/index.vue
+++ b/src/views/system/menu/index.vue
@@ -8,7 +8,7 @@
-
+
diff --git a/src/views/system/oss/index.vue b/src/views/system/oss/index.vue
index 2e50582..a6e60e8 100644
--- a/src/views/system/oss/index.vue
+++ b/src/views/system/oss/index.vue
@@ -13,7 +13,7 @@
-
+
{
showTable.value = true;
};
function checkFileSuffix(fileSuffix: string | string[]) {
- const arr = [".png", ".jpg", ".jpeg"];
+ const arr = ['.png', '.jpg', '.jpeg'];
const suffixArray = Array.isArray(fileSuffix) ? fileSuffix : [fileSuffix];
- return suffixArray.some(suffix => arr.includes(suffix.toLowerCase()));
+ return suffixArray.some((suffix) => arr.includes(suffix.toLowerCase()));
}
/** 取消按钮 */
function cancel() {
diff --git a/src/views/system/role/index.vue b/src/views/system/role/index.vue
index bd84af3..0b6ba00 100644
--- a/src/views/system/role/index.vue
+++ b/src/views/system/role/index.vue
@@ -11,7 +11,7 @@
-
+
diff --git a/src/views/system/user/profile/index.vue b/src/views/system/user/profile/index.vue
index 426fca8..7c1389a 100644
--- a/src/views/system/user/profile/index.vue
+++ b/src/views/system/user/profile/index.vue
@@ -58,8 +58,8 @@
-
-
+
+
@@ -73,7 +73,7 @@ import UserAvatar from './userAvatar.vue';
import UserInfo from './userInfo.vue';
import ResetPwd from './resetPwd.vue';
import ThirdParty from './thirdParty.vue';
-import OnlinDevice from './onlineDevice.vue';
+import OnlineDevice from './onlineDevice.vue';
import { getAuthList } from '@/api/system/social/auth';
import { getUserProfile } from '@/api/system/user';
import { getOnline } from '@/api/monitor/online';
diff --git a/src/views/system/user/profile/onlineDevice.vue b/src/views/system/user/profile/onlineDevice.vue
index 8da96f6..bd7c822 100644
--- a/src/views/system/user/profile/onlineDevice.vue
+++ b/src/views/system/user/profile/onlineDevice.vue
@@ -18,8 +18,7 @@
-
-
+
@@ -55,5 +54,4 @@ const handldDelOnline = (row: any) => {
})
.catch(() => {});
};
-
diff --git a/src/views/system/user/profile/resetPwd.vue b/src/views/system/user/profile/resetPwd.vue
index 6d536da..aae5ef8 100644
--- a/src/views/system/user/profile/resetPwd.vue
+++ b/src/views/system/user/profile/resetPwd.vue
@@ -45,7 +45,7 @@ const rules = ref({
message: '长度在 6 到 20 个字符',
trigger: 'blur'
},
- { pattern: /^[^<>"'|\\]+$/, message: "不能包含非法字符:< > \" ' \\\ |", trigger: "blur" }
+ { pattern: /^[^<>"'|\\]+$/, message: '不能包含非法字符:< > " \' \\\ |', trigger: 'blur' }
],
confirmPassword: [
{ required: true, message: '确认密码不能为空', trigger: 'blur' },
diff --git a/src/views/system/user/profile/thirdParty.vue b/src/views/system/user/profile/thirdParty.vue
index 957122a..5cd7347 100644
--- a/src/views/system/user/profile/thirdParty.vue
+++ b/src/views/system/user/profile/thirdParty.vue
@@ -58,7 +58,7 @@