From 2a538d7da77a5ae7bc329d24c465cba61064ad35 Mon Sep 17 00:00:00 2001
From: "Ray.Hao" <1490493387@qq.com>
Date: Mon, 25 May 2026 22:22:42 +0800
Subject: [PATCH] =?UTF-8?q?refactor:=20=E4=BC=98=E5=8C=96=E4=BB=A3?=
=?UTF-8?q?=E7=A0=81=E8=A7=84=E8=8C=83=E5=92=8C=E5=8F=AF=E8=AF=BB=E6=80=A7?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.husky/commit-msg | 3 +-
.husky/pre-commit | 3 +-
README.md | 8 +-
eslint.config.ts | 10 +-
mock/dict.mock.ts | 6 +-
src/App.vue | 1 -
src/api/auth/index.ts | 13 +-
src/api/codegen/index.ts | 6 +-
src/api/common.ts | 2 +-
src/api/file/index.ts | 4 +-
src/api/system/config/index.ts | 4 +-
src/api/system/dept/index.ts | 6 +-
src/api/system/dict/index.ts | 48 +++---
src/api/system/log/index.ts | 6 +-
src/api/system/menu/index.ts | 8 +-
src/api/system/menu/types.ts | 2 +-
src/api/system/notice/index.ts | 11 +-
src/api/system/role/index.ts | 16 +-
src/api/system/tenant-plan/index.ts | 8 +-
src/api/system/tenant/index.ts | 14 +-
src/api/system/user/index.ts | 12 +-
...wechat-offical.png => wechat-official.png} | Bin
src/components/Breadcrumb/index.vue | 54 +++---
src/components/CURD/PageContent.vue | 14 +-
src/components/CommandPalette/index.vue | 2 +-
src/components/DictTag/index.vue | 4 +-
src/components/SizeSelect/index.vue | 2 +-
src/components/Upload/MultiImageUpload.vue | 8 +-
src/components/Upload/SingleImageUpload.vue | 17 +-
src/composables/sse/useSse.ts | 161 +++++++++++-------
src/main.ts | 2 +
src/types/global.d.ts | 2 +-
src/types/ui/tagsview.ts | 4 +-
src/utils/storage.ts | 4 +-
.../codegen/components/FieldConfigStep.vue | 2 +-
src/views/demo/curd-single.vue | 15 +-
src/views/demo/curd/config/add.ts | 3 -
src/views/demo/curd/config/content.ts | 4 +-
src/views/demo/curd/config/edit.ts | 3 -
src/views/demo/curd/config2/content.ts | 2 -
src/views/demo/curd/config2/edit.ts | 3 -
src/views/demo/curd/config2/search.ts | 7 +-
src/views/demo/curd/index.vue | 12 +-
src/views/demo/detail.vue | 1 -
.../children/children/level3-1.vue | 3 -
.../children/children/level3-2.vue | 3 -
.../demo/multi-level/children/level2.vue | 4 -
src/views/demo/multi-level/level1.vue | 4 -
src/views/demo/signature.vue | 2 +-
src/views/demo/table-select/index.vue | 8 +-
src/views/demo/vxe-table/index.vue | 17 +-
src/views/login/index.vue | 2 +-
src/views/profile/notice/index.vue | 2 +-
src/views/system/dept/index.vue | 2 +-
src/views/system/menu/index.vue | 28 +--
src/views/system/notice/index.vue | 26 +--
56 files changed, 324 insertions(+), 294 deletions(-)
rename src/assets/images/qr/{wechat-offical.png => wechat-official.png} (100%)
diff --git a/.husky/commit-msg b/.husky/commit-msg
index fd2bf708..f6f2ce3f 100755
--- a/.husky/commit-msg
+++ b/.husky/commit-msg
@@ -1 +1,2 @@
-npx --no-install commitlint --edit $1
+#!/usr/bin/env sh
+npx --no-install commitlint --edit "$1"
diff --git a/.husky/pre-commit b/.husky/pre-commit
index beabb122..e77b172c 100755
--- a/.husky/pre-commit
+++ b/.husky/pre-commit
@@ -1 +1,2 @@
-npm run lint:lint-staged
+#!/usr/bin/env sh
+npm run lint:lint-staged
diff --git a/README.md b/README.md
index f024ca69..94cf9cb4 100644
--- a/README.md
+++ b/README.md
@@ -18,7 +18,7 @@

## 项目简介
@@ -100,7 +100,7 @@
| -------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| 视频教程 | [https://www.bilibili.com/video/BV1eFUuYyEFj](https://www.bilibili.com/video/BV1eFUuYyEFj) |
| 项目搭建 | [基于 Vue3 + Vite + TypeScript + Element-Plus 从0到1搭建后台管理系统](https://blog.csdn.net/u013737132/article/details/130191394) |
-| 官方文档 | [https://www.youlai.tech/vue3-element-admin](https://www.youlai.tech/vue3-element-admin/) |
+| 官方文档 | [https://www.youlai.tech/docs/web/](https://www.youlai.tech/docs/web/) |
| 代码规范 | [ESLint V9 + Prettier + Stylelint + EditorConfig 约束和统一前端代码规范](https://youlai.blog.csdn.net/article/details/145608723) |
| 提交规范 | [Husky + Lint-staged + Commitlint + Commitizen + cz-git 配置 Git 提交规范](https://youlai.blog.csdn.net/article/details/145615236) |
| 接口文档 | [https://www.apifox.cn](https://www.apifox.cn/apidoc/shared-195e783f-4d85-4235-a038-eec696de4ea5) |
@@ -177,7 +177,7 @@ server {
1. 获取基于 `Java` 和 `SpringBoot` 开发的后端 [youlai-boot](https://gitee.com/youlaiorg/youlai-boot.git) 源码。
2. 根据后端工程的说明文档 [README.md](https://gitee.com/youlaiorg/youlai-boot#%E9%A1%B9%E7%9B%AE%E8%BF%90%E8%A1%8C) 完成本地启动。
-3. 修改 `.env.development` 文件中的 `VITE_APP_API_URL` 的值,将其从 https://api.youlai.tech 更改为 http://localhost:8989 即可。
+3. 修改 `.env.development` 文件中的 `VITE_APP_API_URL` 的值,将其从 https://api.youlai.tech 更改为 http://localhost:8000 即可。
## 注意事项
@@ -223,7 +223,7 @@ Thanks to all the contributors!
- 
+ 
公众号「有来技术」
|
|
diff --git a/eslint.config.ts b/eslint.config.ts
index a8753377..4c32ca69 100644
--- a/eslint.config.ts
+++ b/eslint.config.ts
@@ -107,8 +107,8 @@ export default [
},
rules: {
// 基础规则
- "no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
- "no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off",
+ "no-console": ["error", { allow: ["warn", "error", "debug"] }],
+ "no-debugger": "error",
// ES6+ 规则
"prefer-const": "error",
@@ -116,7 +116,7 @@ export default [
"object-shorthand": "error",
// 最佳实践
- eqeqeq: "off",
+ eqeqeq: ["error", "always", { null: "ignore" }],
"no-multi-spaces": "error",
"no-multiple-empty-lines": ["error", { max: 1, maxBOF: 0, maxEOF: 0 }],
@@ -171,7 +171,7 @@ export default [
},
],
"vue/component-name-in-template-casing": ["error", "PascalCase"],
- "@typescript-eslint/no-explicit-any": "off",
+ "@typescript-eslint/no-explicit-any": "warn",
},
},
@@ -189,7 +189,7 @@ export default [
},
rules: {
// TypeScript 规则
- "@typescript-eslint/no-explicit-any": "off", // 允许使用any类型,方便开发
+ "@typescript-eslint/no-explicit-any": "warn", // 逐步收敛 any 类型
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-empty-object-type": "off",
"@typescript-eslint/ban-ts-comment": "off",
diff --git a/mock/dict.mock.ts b/mock/dict.mock.ts
index 131709b4..5452f658 100644
--- a/mock/dict.mock.ts
+++ b/mock/dict.mock.ts
@@ -145,7 +145,7 @@ export default defineMock([
let list = null;
- if (dictCode == "gender") {
+ if (dictCode === "gender") {
list = [
{
value: "1",
@@ -160,7 +160,7 @@ export default defineMock([
label: "保密",
},
];
- } else if (dictCode == "notice_level") {
+ } else if (dictCode === "notice_level") {
list = [
{
value: "L",
@@ -178,7 +178,7 @@ export default defineMock([
tagType: "D",
},
];
- } else if (dictCode == "notice_type") {
+ } else if (dictCode === "notice_type") {
list = [
{
value: "1",
diff --git a/src/App.vue b/src/App.vue
index dca8b3a9..bc6d8b0f 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -1,6 +1,5 @@
-
= {
+ const payload: Pick<
+ LoginRequest,
+ "username" | "password" | "captchaId" | "captchaCode" | "tenantId"
+ > = {
username: data.username,
password: data.password,
captchaId: data.captchaId,
@@ -18,7 +21,7 @@ const AuthAPI = {
payload.tenantId = data.tenantId;
}
- return request({
+ return request({
url: `${AUTH_BASE_URL}/login`,
method: "post",
data: payload,
@@ -27,7 +30,7 @@ const AuthAPI = {
/** 切换租户(平台用户) - 返回新的 token */
switchTenant(tenantId: number) {
- return request({
+ return request({
url: `${AUTH_BASE_URL}/switch-tenant`,
method: "post",
params: { tenantId },
@@ -36,7 +39,7 @@ const AuthAPI = {
/** 刷新 token 接口*/
refreshToken(refreshToken: string) {
- return request({
+ return request({
url: `${AUTH_BASE_URL}/refresh-token`,
method: "post",
params: { refreshToken },
@@ -56,7 +59,7 @@ const AuthAPI = {
/** 获取验证码接口*/
getCaptcha() {
- return request({
+ return request({
url: `${AUTH_BASE_URL}/captcha`,
method: "get",
});
diff --git a/src/api/codegen/index.ts b/src/api/codegen/index.ts
index 773e6185..f568b393 100644
--- a/src/api/codegen/index.ts
+++ b/src/api/codegen/index.ts
@@ -6,7 +6,7 @@ const GENERATOR_BASE_URL = "/api/v1/codegen";
const GeneratorAPI = {
/** 获取数据表分页列表 */
getTablePage(params: TableQueryParams) {
- return request>({
+ return request>({
url: `${GENERATOR_BASE_URL}/table`,
method: "get",
params,
@@ -15,7 +15,7 @@ const GeneratorAPI = {
/** 获取代码生成配置 */
getGenConfig(tableName: string) {
- return request({
+ return request({
url: `${GENERATOR_BASE_URL}/${tableName}/config`,
method: "get",
});
@@ -39,7 +39,7 @@ const GeneratorAPI = {
if (type) {
params.type = type;
}
- return request({
+ return request({
url: `${GENERATOR_BASE_URL}/${tableName}/preview`,
method: "get",
params: Object.keys(params).length ? params : undefined,
diff --git a/src/api/common.ts b/src/api/common.ts
index 12a8740f..c6acab7e 100644
--- a/src/api/common.ts
+++ b/src/api/common.ts
@@ -3,7 +3,7 @@
*/
/** API 响应结构 */
-export interface ApiResponse {
+export interface ApiResponse {
/** 响应码 */
code: string;
/** 响应数据 */
diff --git a/src/api/file/index.ts b/src/api/file/index.ts
index 6f2db186..127a1d6b 100644
--- a/src/api/file/index.ts
+++ b/src/api/file/index.ts
@@ -4,7 +4,7 @@ import type { FileInfo } from "./types";
const FileAPI = {
/** 上传文件 (传入 FormData,上传进度回调) */
upload(formData: FormData, onProgress?: (percent: number) => void) {
- return request({
+ return request({
url: "/api/v1/files",
method: "post",
data: formData,
@@ -22,7 +22,7 @@ const FileAPI = {
uploadFile(file: File) {
const formData = new FormData();
formData.append("file", file);
- return request({
+ return request({
url: "/api/v1/files",
method: "post",
data: formData,
diff --git a/src/api/system/config/index.ts b/src/api/system/config/index.ts
index 3fecb74c..8fc33abe 100644
--- a/src/api/system/config/index.ts
+++ b/src/api/system/config/index.ts
@@ -6,7 +6,7 @@ const CONFIG_BASE_URL = "/api/v1/configs";
const ConfigAPI = {
/** 获取配置分页数据 */
getPage(queryParams?: ConfigQueryParams) {
- return request>({
+ return request>({
url: `${CONFIG_BASE_URL}`,
method: "get",
params: queryParams,
@@ -14,7 +14,7 @@ const ConfigAPI = {
},
/** 获取配置表单数据 */
getFormData(id: string) {
- return request({
+ return request({
url: `${CONFIG_BASE_URL}/${id}/form`,
method: "get",
});
diff --git a/src/api/system/dept/index.ts b/src/api/system/dept/index.ts
index fcc9d8ef..a4ade5a1 100644
--- a/src/api/system/dept/index.ts
+++ b/src/api/system/dept/index.ts
@@ -7,7 +7,7 @@ const DEPT_BASE_URL = "/api/v1/depts";
const DeptAPI = {
/** 获取部门树形列表 */
getList(queryParams?: DeptQueryParams) {
- return request({
+ return request({
url: `${DEPT_BASE_URL}`,
method: "get",
params: queryParams,
@@ -15,11 +15,11 @@ const DeptAPI = {
},
/** 获取部门下拉数据源 */
getOptions() {
- return request({ url: `${DEPT_BASE_URL}/options`, method: "get" });
+ return request({ url: `${DEPT_BASE_URL}/options`, method: "get" });
},
/** 获取部门表单数据 */
getFormData(id: string) {
- return request({ url: `${DEPT_BASE_URL}/${id}/form`, method: "get" });
+ return request({ url: `${DEPT_BASE_URL}/${id}/form`, method: "get" });
},
/** 新增部门 */
create(data: DeptForm) {
diff --git a/src/api/system/dict/index.ts b/src/api/system/dict/index.ts
index 7fcd786b..481fce53 100644
--- a/src/api/system/dict/index.ts
+++ b/src/api/system/dict/index.ts
@@ -12,9 +12,11 @@ import type { OptionItem } from "@/api/common";
const DICT_BASE_URL = "/api/v1/dicts";
+type DictTagType = DictItemForm["tagType"];
type DictTagTypeCode = "N" | "P" | "S" | "W" | "I" | "D";
-const decodeDictTagType = (code?: unknown): DictItemForm["tagType"] => {
+// 将后端标签类型转换为前端标签类型
+const decodeDictTagType = (code?: unknown): DictTagType => {
const val = String(code ?? "")
.trim()
.toUpperCase();
@@ -35,6 +37,7 @@ const decodeDictTagType = (code?: unknown): DictItemForm["tagType"] => {
}
};
+// 将前端标签类型转换为后端标签类型
const encodeDictTagType = (tagType?: unknown): DictTagTypeCode => {
const val = String(tagType ?? "")
.trim()
@@ -58,10 +61,20 @@ const encodeDictTagType = (tagType?: unknown): DictTagTypeCode => {
}
};
+// 统一转换字典项标签类型
+const normalizeDictTagType = (
+ item: T
+): Omit & {
+ tagType: DictTagType;
+} => ({
+ ...item,
+ tagType: decodeDictTagType(item.tagType),
+});
+
const DictAPI = {
/** 字典分页列表 */
getPage(queryParams: DictTypeQueryParams) {
- return request>({
+ return request>({
url: `${DICT_BASE_URL}`,
method: "get",
params: queryParams,
@@ -69,11 +82,11 @@ const DictAPI = {
},
/** 字典列表 */
getList() {
- return request({ url: `${DICT_BASE_URL}/options`, method: "get" });
+ return request({ url: `${DICT_BASE_URL}/options`, method: "get" });
},
/** 字典表单数据 */
getFormData(id: string) {
- return request({ url: `${DICT_BASE_URL}/${id}/form`, method: "get" });
+ return request({ url: `${DICT_BASE_URL}/${id}/form`, method: "get" });
},
/** 新增字典 */
create(data: DictTypeForm) {
@@ -90,29 +103,21 @@ const DictAPI = {
/** 获取字典项分页列表 */
getDictItemPage(dictCode: string, queryParams: DictItemQueryParams) {
- return request>({
+ return request>({
url: `${DICT_BASE_URL}/${dictCode}/items`,
method: "get",
params: queryParams,
}).then((data) => ({
...data,
- list: (data.list ?? []).map((item: DictItem & { tagType?: string }) => ({
- ...item,
- tagType: decodeDictTagType(item.tagType),
- })),
+ list: (data.list ?? []).map(normalizeDictTagType),
}));
},
/** 获取字典项列表 */
getDictItems(dictCode: string) {
- return request({
+ return request({
url: `${DICT_BASE_URL}/${dictCode}/items/options`,
method: "get",
- }).then((items) =>
- (items ?? []).map((item) => ({
- ...item,
- tagType: decodeDictTagType((item as any).tagType),
- }))
- );
+ }).then((items) => (items ?? []).map(normalizeDictTagType));
},
/** 新增字典项 */
createDictItem(dictCode: string, data: DictItemForm) {
@@ -121,19 +126,16 @@ const DictAPI = {
method: "post",
data: {
...data,
- tagType: encodeDictTagType((data as any).tagType),
+ tagType: encodeDictTagType(data.tagType),
},
});
},
/** 获取字典项表单数据 */
getDictItemFormData(dictCode: string, id: string) {
- return request({
+ return request({
url: `${DICT_BASE_URL}/${dictCode}/items/${id}/form`,
method: "get",
- }).then((form) => ({
- ...form,
- tagType: decodeDictTagType((form as any).tagType),
- }));
+ }).then(normalizeDictTagType);
},
/** 修改字典项 */
updateDictItem(dictCode: string, id: string, data: DictItemForm) {
@@ -142,7 +144,7 @@ const DictAPI = {
method: "put",
data: {
...data,
- tagType: encodeDictTagType((data as any).tagType),
+ tagType: encodeDictTagType(data.tagType),
},
});
},
diff --git a/src/api/system/log/index.ts b/src/api/system/log/index.ts
index 99af549d..f3cf30f1 100644
--- a/src/api/system/log/index.ts
+++ b/src/api/system/log/index.ts
@@ -12,7 +12,7 @@ const LOG_BASE_URL = "/api/v1/logs";
const LogAPI = {
/** 获取日志分页列表 */
getPage(queryParams: LogQueryParams) {
- return request>({
+ return request>({
url: `${LOG_BASE_URL}`,
method: "get",
params: queryParams,
@@ -21,7 +21,7 @@ const LogAPI = {
/** 获取访问趋势统计 */
getVisitTrend(queryParams: VisitTrendQueryParams) {
- return request({
+ return request({
url: `${LOG_BASE_URL}/analytics/trend`,
method: "get",
params: queryParams,
@@ -30,7 +30,7 @@ const LogAPI = {
/** 获取访问概览统计 */
getVisitOverview() {
- return request({
+ return request({
url: `${LOG_BASE_URL}/analytics/overview`,
method: "get",
});
diff --git a/src/api/system/menu/index.ts b/src/api/system/menu/index.ts
index 966a3b77..0bfb8054 100644
--- a/src/api/system/menu/index.ts
+++ b/src/api/system/menu/index.ts
@@ -7,11 +7,11 @@ const MENU_BASE_URL = "/api/v1/menus";
const MenuAPI = {
/** 获取当前用户的路由列表 */
getRoutes() {
- return request({ url: `${MENU_BASE_URL}/routes`, method: "get" });
+ return request({ url: `${MENU_BASE_URL}/routes`, method: "get" });
},
/** 获取菜单树形列表 */
getList(queryParams: MenuQueryParams) {
- return request({
+ return request({
url: `${MENU_BASE_URL}`,
method: "get",
params: queryParams,
@@ -19,7 +19,7 @@ const MenuAPI = {
},
/** 获取菜单下拉数据源 */
getOptions(onlyParent?: boolean, scope?: number) {
- return request({
+ return request({
url: `${MENU_BASE_URL}/options`,
method: "get",
params: { onlyParent, scope },
@@ -27,7 +27,7 @@ const MenuAPI = {
},
/** 获取菜单表单数据 */
getFormData(id: string) {
- return request({ url: `${MENU_BASE_URL}/${id}/form`, method: "get" });
+ return request({ url: `${MENU_BASE_URL}/${id}/form`, method: "get" });
},
/** 新增菜单 */
create(data: MenuForm) {
diff --git a/src/api/system/menu/types.ts b/src/api/system/menu/types.ts
index 50307719..1c3b7afa 100644
--- a/src/api/system/menu/types.ts
+++ b/src/api/system/menu/types.ts
@@ -109,7 +109,7 @@ export interface Meta {
/** 【菜单】是否开启页面缓存 */
keepAlive?: boolean;
/** 路由参数 */
- params?: Record;
+ params?: Record;
/** 角色集合 */
roles?: string[];
/** 路由title */
diff --git a/src/api/system/notice/index.ts b/src/api/system/notice/index.ts
index 64d257a4..9c873899 100644
--- a/src/api/system/notice/index.ts
+++ b/src/api/system/notice/index.ts
@@ -6,7 +6,7 @@ const NOTICE_BASE_URL = "/api/v1/notices";
const NoticeAPI = {
/** 获取通知公告分页数据 */
getPage(queryParams?: NoticeQueryParams) {
- return request>({
+ return request>({
url: `${NOTICE_BASE_URL}`,
method: "get",
params: queryParams,
@@ -14,7 +14,7 @@ const NoticeAPI = {
},
/** 获取通知公告表单数据 */
getFormData(id: string) {
- return request({ url: `${NOTICE_BASE_URL}/${id}/form`, method: "get" });
+ return request({ url: `${NOTICE_BASE_URL}/${id}/form`, method: "get" });
},
/** 添加通知公告 */
create(data: NoticeForm) {
@@ -38,7 +38,10 @@ const NoticeAPI = {
},
/** 查看通知 */
getDetail(id: string) {
- return request({ url: `${NOTICE_BASE_URL}/${id}/detail`, method: "get" });
+ return request({
+ url: `${NOTICE_BASE_URL}/${id}/detail`,
+ method: "get",
+ });
},
/** 全部已读 */
readAll() {
@@ -46,7 +49,7 @@ const NoticeAPI = {
},
/** 获取我的通知分页列表 */
getMyNoticePage(queryParams?: NoticeQueryParams) {
- return request>({
+ return request>({
url: `${NOTICE_BASE_URL}/my`,
method: "get",
params: queryParams,
diff --git a/src/api/system/role/index.ts b/src/api/system/role/index.ts
index 2ab1053c..81311a5f 100644
--- a/src/api/system/role/index.ts
+++ b/src/api/system/role/index.ts
@@ -7,7 +7,7 @@ const ROLE_BASE_URL = "/api/v1/roles";
const RoleAPI = {
/** 获取角色分页数据 */
getPage(queryParams?: RoleQueryParams) {
- return request>({
+ return request>({
url: `${ROLE_BASE_URL}`,
method: "get",
params: queryParams,
@@ -15,11 +15,14 @@ const RoleAPI = {
},
/** 获取角色下拉数据源 */
getOptions() {
- return request({ url: `${ROLE_BASE_URL}/options`, method: "get" });
+ return request({ url: `${ROLE_BASE_URL}/options`, method: "get" });
},
/** 获取角色的菜单ID集合 */
getRoleMenuIds(roleId: string) {
- return request({ url: `${ROLE_BASE_URL}/${roleId}/menu-ids`, method: "get" });
+ return request({
+ url: `${ROLE_BASE_URL}/${roleId}/menu-ids`,
+ method: "get",
+ });
},
/** 分配菜单权限 */
updateRoleMenus(roleId: string, data: number[]) {
@@ -27,11 +30,14 @@ const RoleAPI = {
},
/** 获取角色表单数据 */
getFormData(id: string) {
- return request({ url: `${ROLE_BASE_URL}/${id}/form`, method: "get" });
+ return request({ url: `${ROLE_BASE_URL}/${id}/form`, method: "get" });
},
/** 获取角色的部门ID集合(自定义数据权限) */
getRoleDeptIds(roleId: string) {
- return request({ url: `${ROLE_BASE_URL}/${roleId}/dept-ids`, method: "get" });
+ return request({
+ url: `${ROLE_BASE_URL}/${roleId}/dept-ids`,
+ method: "get",
+ });
},
/** 新增角色 */
create(data: RoleForm) {
diff --git a/src/api/system/tenant-plan/index.ts b/src/api/system/tenant-plan/index.ts
index 1eb27450..b571c5bb 100644
--- a/src/api/system/tenant-plan/index.ts
+++ b/src/api/system/tenant-plan/index.ts
@@ -7,7 +7,7 @@ const TENANT_PLAN_BASE_URL = "/api/v1/tenant-plans";
const TenantPlanAPI = {
/** 获取租户套餐分页数据 */
getPage(queryParams?: TenantPlanQueryParams) {
- return request>({
+ return request>({
url: `${TENANT_PLAN_BASE_URL}`,
method: "get",
params: queryParams,
@@ -16,7 +16,7 @@ const TenantPlanAPI = {
/** 获取租户套餐表单数据 */
getFormData(planId: string) {
- return request({
+ return request({
url: `${TENANT_PLAN_BASE_URL}/${planId}/form`,
method: "get",
});
@@ -39,7 +39,7 @@ const TenantPlanAPI = {
/** 获取租户方案下拉选项 */
getOptions() {
- return request({
+ return request({
url: `${TENANT_PLAN_BASE_URL}/options`,
method: "get",
});
@@ -47,7 +47,7 @@ const TenantPlanAPI = {
/** 获取方案菜单ID集合 */
getPlanMenuIds(planId: number) {
- return request({
+ return request({
url: `${TENANT_PLAN_BASE_URL}/${planId}/menuIds`,
method: "get",
});
diff --git a/src/api/system/tenant/index.ts b/src/api/system/tenant/index.ts
index 66eb83d0..8f713682 100644
--- a/src/api/system/tenant/index.ts
+++ b/src/api/system/tenant/index.ts
@@ -19,7 +19,7 @@ const TenantAPI = {
* 获取当前用户可访问的租户列表
*/
getTenantList() {
- return request({
+ return request({
url: `${TENANT_BASE_URL}/options`,
method: "get",
});
@@ -29,7 +29,7 @@ const TenantAPI = {
* 获取当前租户信息
*/
getCurrentTenant() {
- return request({
+ return request({
url: `${TENANT_BASE_URL}/current`,
method: "get",
});
@@ -41,7 +41,7 @@ const TenantAPI = {
* @param tenantId 目标租户ID
*/
switchTenant(tenantId: number) {
- return request({
+ return request({
url: `${TENANT_BASE_URL}/${tenantId}/switch`,
method: "post",
});
@@ -49,7 +49,7 @@ const TenantAPI = {
/** 获取租户分页数据(平台租户管理) */
getPage(queryParams?: TenantQueryParams) {
- return request>({
+ return request>({
url: `${TENANT_BASE_URL}`,
method: "get",
params: queryParams,
@@ -58,7 +58,7 @@ const TenantAPI = {
/** 获取租户表单数据 */
getFormData(tenantId: string) {
- return request({
+ return request({
url: `${TENANT_BASE_URL}/${tenantId}/form`,
method: "get",
});
@@ -66,7 +66,7 @@ const TenantAPI = {
/** 新增租户并初始化默认数据 */
create(data: TenantCreateForm) {
- return request({
+ return request({
url: `${TENANT_BASE_URL}`,
method: "post",
data,
@@ -101,7 +101,7 @@ const TenantAPI = {
/** 获取租户菜单ID集合 */
getTenantMenuIds(tenantId: number) {
- return request({
+ return request({
url: `${TENANT_BASE_URL}/${tenantId}/menuIds`,
method: "get",
});
diff --git a/src/api/system/user/index.ts b/src/api/system/user/index.ts
index 3eb314ff..36195472 100644
--- a/src/api/system/user/index.ts
+++ b/src/api/system/user/index.ts
@@ -22,7 +22,7 @@ const UserAPI = {
* @returns 登录用户昵称、头像信息,包括角色和权限
*/
getInfo() {
- return request({
+ return request({
url: `${USER_BASE_URL}/me`,
method: "get",
});
@@ -34,7 +34,7 @@ const UserAPI = {
* @param queryParams 查询参数
*/
getPage(queryParams: UserQueryParams) {
- return request>({
+ return request>({
url: `${USER_BASE_URL}`,
method: "get",
params: queryParams,
@@ -48,7 +48,7 @@ const UserAPI = {
* @returns 用户表单详情
*/
getFormData(userId: string) {
- return request({
+ return request({
url: `${USER_BASE_URL}/${userId}/form`,
method: "get",
});
@@ -138,7 +138,7 @@ const UserAPI = {
import(file: File) {
const formData = new FormData();
formData.append("file", file);
- return request({
+ return request({
url: `${USER_BASE_URL}/import`,
method: "post",
data: formData,
@@ -150,7 +150,7 @@ const UserAPI = {
/** 获取个人中心用户信息 */
getProfile() {
- return request({
+ return request({
url: `${USER_BASE_URL}/profile`,
method: "get",
});
@@ -232,7 +232,7 @@ const UserAPI = {
* 获取用户下拉列表
*/
getOptions() {
- return request({
+ return request({
url: `${USER_BASE_URL}/options`,
method: "get",
});
diff --git a/src/assets/images/qr/wechat-offical.png b/src/assets/images/qr/wechat-official.png
similarity index 100%
rename from src/assets/images/qr/wechat-offical.png
rename to src/assets/images/qr/wechat-official.png
diff --git a/src/components/Breadcrumb/index.vue b/src/components/Breadcrumb/index.vue
index 48bd4ec2..d0900ed2 100644
--- a/src/components/Breadcrumb/index.vue
+++ b/src/components/Breadcrumb/index.vue
@@ -15,56 +15,72 @@
diff --git a/src/composables/sse/useSse.ts b/src/composables/sse/useSse.ts
index 700b4592..9fa5ae47 100644
--- a/src/composables/sse/useSse.ts
+++ b/src/composables/sse/useSse.ts
@@ -10,7 +10,13 @@ export interface UseSseOptions {
maxReconnectAttempts?: number; // 最大重试次数,超过后停止重连
}
-type EventHandler = (data: any) => void;
+type EventHandler = (data: unknown) => void;
+
+type SseParseState = {
+ currentEvent: string;
+ currentData: string;
+ buffer: string;
+};
export enum SseConnectionState {
DISCONNECTED = "DISCONNECTED", // 未连接
@@ -46,9 +52,14 @@ function createSseConnection(options: UseSseOptions = {}) {
const eventHandlers = new Map>();
- const log = (...args: any[]) => console.log("[SSE]", ...args);
- const logError = (...args: any[]) => console.error("[SSE]", ...args);
+ const log = (...args: unknown[]) => {
+ if (config.debug) {
+ console.debug("[SSE]", ...args);
+ }
+ };
+ const logError = (...args: unknown[]) => console.error("[SSE]", ...args);
+ // 清理定时器并返回空值
const clearTimer = (timer: typeof connectionTimeoutTimer) => {
if (timer) {
clearTimeout(timer);
@@ -57,6 +68,74 @@ function createSseConnection(options: UseSseOptions = {}) {
return timer;
};
+ // 重置重连计数和间隔
+ const resetReconnectState = () => {
+ reconnectAttempts = 0;
+ currentReconnectInterval = config.reconnectInterval;
+ };
+
+ // 更新下一次重连间隔
+ const advanceReconnectState = () => {
+ currentReconnectInterval = Math.min(currentReconnectInterval * 2, config.maxReconnectInterval);
+ };
+
+ // 分发一条完整的 SSE 事件
+ const flushSseEvent = (eventName: string, data: string) => {
+ if (!data) return;
+ const handlers = eventHandlers.get(eventName);
+ if (handlers) {
+ try {
+ const parsed = JSON.parse(data);
+ handlers.forEach((handler) => handler(parsed));
+ } catch {
+ handlers.forEach((handler) => handler(data));
+ }
+ }
+ log(`收到事件[${eventName}]:`, data);
+ };
+
+ // 解析单行 SSE 文本并更新当前事件状态
+ const handleSseLine = (line: string, state: SseParseState) => {
+ if (line.startsWith(":")) return;
+ if (line.startsWith("event:")) {
+ state.currentEvent = line.slice(6).trim() || "message";
+ return;
+ }
+ if (line.startsWith("data:")) {
+ const dataLine = line.slice(5).trim();
+ state.currentData = state.currentData ? `${state.currentData}\n${dataLine}` : dataLine;
+ return;
+ }
+ if (line === "") {
+ flushSseEvent(state.currentEvent, state.currentData);
+ state.currentEvent = "message";
+ state.currentData = "";
+ }
+ };
+
+ // 持续读取 SSE 流并按行解析
+ const consumeSseStream = async (streamReader: ReadableStreamDefaultReader) => {
+ const decoder = new TextDecoder();
+ const state: SseParseState = { currentEvent: "message", currentData: "", buffer: "" };
+
+ while (true) {
+ const { done, value } = await streamReader.read();
+ if (done) {
+ connectionState.value = SseConnectionState.DISCONNECTED;
+ log("SSE 连接已关闭");
+ return;
+ }
+
+ state.buffer += decoder.decode(value, { stream: true });
+ const lines = state.buffer.split("\n");
+ state.buffer = lines.pop() || "";
+
+ for (const line of lines) {
+ handleSseLine(line, state);
+ }
+ }
+ };
+
// 指数退避重连
const scheduleReconnect = () => {
if (isManualDisconnect) return;
@@ -70,13 +149,11 @@ function createSseConnection(options: UseSseOptions = {}) {
reconnectTimer = setTimeout(() => {
connect();
- currentReconnectInterval = Math.min(
- currentReconnectInterval * 2,
- config.maxReconnectInterval
- );
+ advanceReconnectState();
}, currentReconnectInterval);
};
+ // 建立 SSE 连接
const connect = () => {
isManualDisconnect = false;
@@ -122,66 +199,17 @@ function createSseConnection(options: UseSseOptions = {}) {
}
connectionTimeoutTimer = clearTimer(connectionTimeoutTimer);
connectionState.value = SseConnectionState.CONNECTED;
- reconnectAttempts = 0;
- currentReconnectInterval = config.reconnectInterval;
+ resetReconnectState();
log("SSE 连接已建立");
return response.body?.getReader();
})
- .then((r) => {
- if (!r) return;
- reader = r;
- const decoder = new TextDecoder();
- let buffer = "";
- let currentEvent = "message";
- let currentData = "";
-
- // SSE 文本协议解析:event / data / 空行分隔
- const processChunk = ({
- done,
- value,
- }: ReadableStreamReadResult): Promise | void => {
- if (done) {
- connectionState.value = SseConnectionState.DISCONNECTED;
- log("SSE 连接已关闭");
- return;
- }
-
- buffer += decoder.decode(value, { stream: true });
- const lines = buffer.split("\n");
- buffer = lines.pop() || "";
-
- for (const line of lines) {
- if (line.startsWith(":")) continue;
- if (line.startsWith("event:")) {
- currentEvent = line.slice(6).trim();
- } else if (line.startsWith("data:")) {
- const dataLine = line.slice(5).trim();
- currentData = currentData ? `${currentData}\n${dataLine}` : dataLine;
- } else if (line === "") {
- if (currentData) {
- const handlers = eventHandlers.get(currentEvent);
- if (handlers) {
- try {
- const data = JSON.parse(currentData);
- handlers.forEach((h) => h(data));
- } catch {
- handlers.forEach((h) => h(currentData));
- }
- }
- log(`收到事件[${currentEvent}]:`, currentData);
- }
- currentEvent = "message";
- currentData = "";
- }
- }
-
- return reader!.read().then(processChunk);
- };
-
- return reader.read().then(processChunk);
+ .then((streamReader) => {
+ if (!streamReader) return;
+ reader = streamReader;
+ return consumeSseStream(streamReader);
})
- .catch((err) => {
- if (err.name === "AbortError") {
+ .catch((err: unknown) => {
+ if (err instanceof Error && err.name === "AbortError") {
log("SSE 连接已主动断开");
} else {
logError("SSE 连接错误:", err);
@@ -192,17 +220,18 @@ function createSseConnection(options: UseSseOptions = {}) {
};
// 订阅事件,返回取消函数
- const on = (eventName: string, handler: EventHandler): (() => void) => {
+ const on = (eventName: string, handler: (data: T) => void): (() => void) => {
if (!eventHandlers.has(eventName)) {
eventHandlers.set(eventName, new Set());
}
- eventHandlers.get(eventName)!.add(handler);
+ const wrappedHandler: EventHandler = (data) => handler(data as T);
+ eventHandlers.get(eventName)!.add(wrappedHandler);
log(`已订阅事件: ${eventName}`);
return () => {
const handlers = eventHandlers.get(eventName);
if (handlers) {
- handlers.delete(handler);
+ handlers.delete(wrappedHandler);
if (handlers.size === 0) {
eventHandlers.delete(eventName);
}
diff --git a/src/main.ts b/src/main.ts
index 4e19947c..ee2144eb 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -20,6 +20,7 @@ import "animate.css";
import { setupDirective } from "@/directives";
import { setupRouter } from "@/router";
import { setupStore } from "@/stores";
+import { setupI18n } from "@/lang";
// ===== 全局组件 =====
import * as ElementPlusIcons from "@element-plus/icons-vue";
@@ -40,6 +41,7 @@ const app = createApp(App);
// 1️⃣ 核心配置
setupDirective(app);
+setupI18n(app);
setupRouter(app);
setupStore(app);
diff --git a/src/types/global.d.ts b/src/types/global.d.ts
index d97cfaf4..cfe67152 100644
--- a/src/types/global.d.ts
+++ b/src/types/global.d.ts
@@ -4,7 +4,7 @@
* @deprecated 请使用 @/types 下的具名导出
*/
declare global {
- type ApiResponse = import("@/types/api").ApiResponse;
+ type ApiResponse = import("@/types/api").ApiResponse;
type BaseQueryParams = import("@/types/api").BaseQueryParams;
type PageResult = import("@/types/api").PageResult;
type OptionItem = import("@/types/api").OptionItem;
diff --git a/src/types/ui/tagsview.ts b/src/types/ui/tagsview.ts
index 5cc68ce8..e511bb57 100644
--- a/src/types/ui/tagsview.ts
+++ b/src/types/ui/tagsview.ts
@@ -1,3 +1,5 @@
+import type { LocationQuery } from "vue-router";
+
/**
* 标签页相关类型定义
*/
@@ -10,5 +12,5 @@ export interface TagView {
icon?: string;
affix?: boolean;
keepAlive?: boolean;
- query?: any;
+ query?: LocationQuery;
}
diff --git a/src/utils/storage.ts b/src/utils/storage.ts
index acb3c9a4..511a7cf0 100644
--- a/src/utils/storage.ts
+++ b/src/utils/storage.ts
@@ -15,7 +15,7 @@ export class Storage {
/**
* 存储数据到 localStorage
*/
- static set(key: string, value: any): void {
+ static set(key: string, value: unknown): void {
localStorage.setItem(key, JSON.stringify(value));
}
@@ -46,7 +46,7 @@ export class Storage {
/**
* 存储数据到 sessionStorage
*/
- static sessionSet(key: string, value: any): void {
+ static sessionSet(key: string, value: unknown): void {
sessionStorage.setItem(key, JSON.stringify(value));
}
diff --git a/src/views/codegen/components/FieldConfigStep.vue b/src/views/codegen/components/FieldConfigStep.vue
index 14efe035..61e2df52 100644
--- a/src/views/codegen/components/FieldConfigStep.vue
+++ b/src/views/codegen/components/FieldConfigStep.vue
@@ -111,7 +111,7 @@
-
+
{{ row.columnName }}
diff --git a/src/views/demo/curd-single.vue b/src/views/demo/curd-single.vue
index 7c06e8be..02e27d5e 100644
--- a/src/views/demo/curd-single.vue
+++ b/src/views/demo/curd-single.vue
@@ -30,8 +30,8 @@
@filter-change="handleFilterChange"
>
-
- {{ scope.row[scope.prop] == 1 ? "启用" : "禁用" }}
+
+ {{ scope.row[scope.prop] === 1 ? "启用" : "禁用" }}
@@ -187,13 +187,11 @@ const contentConfig: IContentConfig = reactive({
},
exportAction: UserAPI.export,
importTemplate: UserAPI.downloadTemplate,
- importsAction(data: any) {
- console.log("importsAction", data);
+ importsAction() {
return Promise.resolve();
},
async exportsAction(params: any) {
const data = await UserAPI.getPage(params);
- console.log("exportsAction", data.list);
return data.list;
},
pk: "id",
@@ -299,9 +297,6 @@ const addModalConfig: IModalConfig = reactive({
labelWidth: 100,
},
formAction: UserAPI.create,
- beforeSubmit(data: any) {
- console.log("提交之前处理", data);
- },
formItems: [
{
label: "用户名",
@@ -415,9 +410,6 @@ const editModalConfig: IModalConfig = reactive({
size: useAppStore().device === DeviceEnum.MOBILE ? "80%" : 500,
},
pk: "id",
- beforeSubmit(data: any) {
- console.log("beforeSubmit", data);
- },
formAction(data: any) {
return UserAPI.update(data.id as string, data);
},
@@ -539,7 +531,6 @@ const {
// 其他工具
function handleToolbarClick(name: string) {
- console.log(name);
if (name === "custom1") {
ElMessage.success("点击了自定义1按钮");
}
diff --git a/src/views/demo/curd/config/add.ts b/src/views/demo/curd/config/add.ts
index 96a12dce..cf1746d1 100644
--- a/src/views/demo/curd/config/add.ts
+++ b/src/views/demo/curd/config/add.ts
@@ -14,9 +14,6 @@ const modalConfig: IModalConfig = {
labelWidth: 100,
},
formAction: UserAPI.create,
- beforeSubmit(data) {
- console.log("提交之前处理", data);
- },
formItems: [
{
label: "用户名",
diff --git a/src/views/demo/curd/config/content.ts b/src/views/demo/curd/config/content.ts
index 41e73f79..7f0b9a11 100644
--- a/src/views/demo/curd/config/content.ts
+++ b/src/views/demo/curd/config/content.ts
@@ -24,15 +24,13 @@ const contentConfig: IContentConfig = {
},
exportAction: UserAPI.export,
importTemplate: UserAPI.downloadTemplate,
- importsAction(data) {
+ importsAction() {
// 模拟导入数据
- console.log("importsAction", data);
return Promise.resolve();
},
async exportsAction(params) {
// 模拟获取到的是全量数据
const data = await UserAPI.getPage(params);
- console.log("exportsAction", data.list);
return data.list;
},
pk: "id",
diff --git a/src/views/demo/curd/config/edit.ts b/src/views/demo/curd/config/edit.ts
index 10997277..60d7030a 100644
--- a/src/views/demo/curd/config/edit.ts
+++ b/src/views/demo/curd/config/edit.ts
@@ -13,9 +13,6 @@ const modalConfig: IModalConfig = {
size: useAppStore().device === DeviceEnum.MOBILE ? "80%" : 500,
},
pk: "id",
- beforeSubmit(data) {
- console.log("beforeSubmit", data);
- },
formAction(data) {
return UserAPI.update(data.id as string, data);
},
diff --git a/src/views/demo/curd/config2/content.ts b/src/views/demo/curd/config2/content.ts
index 72d6f5f5..fbf4cfa5 100644
--- a/src/views/demo/curd/config2/content.ts
+++ b/src/views/demo/curd/config2/content.ts
@@ -30,7 +30,6 @@ const contentConfig: IContentConfig = {
toolbar: [],
indexAction(params) {
// 模拟发起网络请求获取列表数据
- console.log("indexAction:", params);
const list = [
{
id: 1,
@@ -74,7 +73,6 @@ const contentConfig: IContentConfig = {
},
modifyAction(data) {
// 模拟发起网络请求修改字段
- // console.log("modifyAction:", data);
ElMessage.success(JSON.stringify(data));
return Promise.resolve(null);
},
diff --git a/src/views/demo/curd/config2/edit.ts b/src/views/demo/curd/config2/edit.ts
index 940e0888..bfdbc383 100644
--- a/src/views/demo/curd/config2/edit.ts
+++ b/src/views/demo/curd/config2/edit.ts
@@ -12,9 +12,6 @@ const modalConfig: IModalConfig = {
size: useAppStore().device === DeviceEnum.MOBILE ? "80%" : 500,
},
form: { labelPosition: "right", labelWidth: "auto" },
- beforeSubmit(data) {
- console.log("beforeSubmit", data);
- },
formAction(data) {
// return UserAPI.update(data.id as string, data);
// 模拟发起网络请求修改字段
diff --git a/src/views/demo/curd/config2/search.ts b/src/views/demo/curd/config2/search.ts
index 83c1a102..09931d9e 100644
--- a/src/views/demo/curd/config2/search.ts
+++ b/src/views/demo/curd/config2/search.ts
@@ -15,8 +15,7 @@ const searchConfig: ISearchConfig = {
prop: "testInput",
attrs: { placeholder: "请输入", clearable: true },
events: {
- change: (e) => {
- console.log("输入框的值: ", e);
+ change: () => {
// 级联操作示例,需要使用reactive提前定义数组
// selectOptions.push({ label: e, value: e });
},
@@ -35,9 +34,7 @@ const searchConfig: ISearchConfig = {
attrs: { placeholder: "全部", clearable: true },
options: stateArr as any,
events: {
- change(e) {
- console.log("选中的值: ", e);
- },
+ change() {},
},
},
{
diff --git a/src/views/demo/curd/index.vue b/src/views/demo/curd/index.vue
index 16ff8e78..18844de7 100644
--- a/src/views/demo/curd/index.vue
+++ b/src/views/demo/curd/index.vue
@@ -33,8 +33,8 @@
@filter-change="handleFilterChange"
>
-
- {{ scope.row[scope.prop] == 1 ? "启用" : "禁用" }}
+
+ {{ scope.row[scope.prop] === 1 ? "启用" : "禁用" }}
@@ -91,8 +91,8 @@
@operate-click="handleOperateClick2"
>
-
- {{ scope.row[scope.prop] == 1 ? "启用" : "禁用" }}
+
+ {{ scope.row[scope.prop] === 1 ? "启用" : "禁用" }}
@@ -145,7 +145,6 @@ const {
// 其他工具
function handleToolbarClick(name: string) {
- console.log(name);
if (name === "custom1") {
ElMessage.success("点击了自定义1按钮");
}
@@ -203,8 +202,7 @@ const addModalRef2 = ref();
const openSecondModal = () => {
handleAddClick(addModalRef2 as Ref);
};
-const secondSubmit = (formData: any) => {
- console.log("secondSubmit", formData);
+const secondSubmit = () => {
ElMessage.success("二级弹窗提交成功");
};
diff --git a/src/views/demo/detail.vue b/src/views/demo/detail.vue
index e4cc0f6f..3ac3effb 100644
--- a/src/views/demo/detail.vue
+++ b/src/views/demo/detail.vue
@@ -11,7 +11,6 @@ defineOptions({
});
const route = useRoute();
-console.log(route);
const value = ref("");
diff --git a/src/views/demo/multi-level/children/children/level3-1.vue b/src/views/demo/multi-level/children/children/level3-1.vue
index 81deb5be..b9212632 100644
--- a/src/views/demo/multi-level/children/children/level3-1.vue
+++ b/src/views/demo/multi-level/children/children/level3-1.vue
@@ -17,7 +17,4 @@ import MultiLevel2 from "../level2.vue";
defineOptions({ name: "MultiLevel31" });
const value = ref("");
-onMounted(() => {
- console.log("Multilevel31 onMounted");
-});
diff --git a/src/views/demo/multi-level/children/children/level3-2.vue b/src/views/demo/multi-level/children/children/level3-2.vue
index 9eb13f17..11a176c7 100644
--- a/src/views/demo/multi-level/children/children/level3-2.vue
+++ b/src/views/demo/multi-level/children/children/level3-2.vue
@@ -17,7 +17,4 @@ import MultiLevel2 from "../level2.vue";
defineOptions({ name: "MultiLevel32" });
const value = ref("");
-onMounted(() => {
- console.log("Multilevel32 onMounted");
-});
diff --git a/src/views/demo/multi-level/children/level2.vue b/src/views/demo/multi-level/children/level2.vue
index 8c9d9513..de9932b5 100644
--- a/src/views/demo/multi-level/children/level2.vue
+++ b/src/views/demo/multi-level/children/level2.vue
@@ -6,8 +6,4 @@
defineOptions({ name: "MultiLevel2" });
const value = ref("");
-
-onMounted(() => {
- console.log("MultiLevel2 mounted");
-});
diff --git a/src/views/demo/multi-level/level1.vue b/src/views/demo/multi-level/level1.vue
index 3fadc392..dc3add59 100644
--- a/src/views/demo/multi-level/level1.vue
+++ b/src/views/demo/multi-level/level1.vue
@@ -3,8 +3,4 @@
diff --git a/src/views/demo/signature.vue b/src/views/demo/signature.vue
index 0131eabe..3e65be93 100644
--- a/src/views/demo/signature.vue
+++ b/src/views/demo/signature.vue
@@ -104,7 +104,7 @@ const isCanvasBlank = (canvas: HTMLCanvasElement) => {
const blank = document.createElement("canvas"); //系统获取一个空canvas对象
blank.width = canvas.width;
blank.height = canvas.height;
- return canvas.toDataURL() == blank.toDataURL(); //比较值相等则为空
+ return canvas.toDataURL() === blank.toDataURL(); //比较值相等则为空
};
// 保存为图片
diff --git a/src/views/demo/table-select/index.vue b/src/views/demo/table-select/index.vue
index 3ac9fb21..7bb58e7a 100644
--- a/src/views/demo/table-select/index.vue
+++ b/src/views/demo/table-select/index.vue
@@ -11,8 +11,8 @@
-
- {{ scope.row[scope.prop] == 1 ? "启用" : "禁用" }}
+
+ {{ scope.row[scope.prop] === 1 ? "启用" : "禁用" }}
@@ -46,7 +46,9 @@ function handleConfirm(data: IUser[]) {
const text = computed(() => {
// 获取字典数据
const dictData = dictStore.getDictItems("gender");
- const genderLabel = dictData.find((item: any) => item.value == selectedUser.value?.gender)?.label;
+ const genderLabel = dictData.find(
+ (item) => String(item.value) === String(selectedUser.value?.gender)
+ )?.label;
return selectedUser.value
? `${selectedUser.value.username} - ${genderLabel} - ${selectedUser.value.deptName}`
: "";
diff --git a/src/views/demo/vxe-table/index.vue b/src/views/demo/vxe-table/index.vue
index cbe260c8..5be856ab 100644
--- a/src/views/demo/vxe-table/index.vue
+++ b/src/views/demo/vxe-table/index.vue
@@ -348,8 +348,7 @@ const gridOptions = reactive>({
},
ajax: {
// 接收 Promise
- query: ({ page: { currentPage, pageSize }, form, filters, sort, sorts }) => {
- console.log({ currentPage, pageSize, form, filters, sort, sorts });
+ query: ({ page: { currentPage, pageSize } }) => {
return new Promise<{ total: number; result: RowMeta[] }>((resolve) => {
setTimeout(() => {
const list = [
@@ -465,9 +464,7 @@ const gridOptions = reactive>({
});
const gridEvents: VxeGridListeners = {
// 只对 form-config 配置时有效,表单重置时会触发该事件
- formReset() {
- console.log("Form Reset");
- },
+ formReset() {},
};
// #endregion
@@ -593,7 +590,10 @@ const curd = {
},
/** 确定并保存 */
onSubmitForm: () => {
- console.log("提交表单");
+ VXETable.modal.message({
+ content: "提交成功",
+ status: "success",
+ });
},
onDelete: (row?: RowMeta) => {
let ids = [];
@@ -614,7 +614,10 @@ const curd = {
VXETable.modal.confirm("确定要删除吗?").then((type) => {
if (type === "confirm") {
// 执行删除操作
- console.log("删除的ID", ids);
+ VXETable.modal.message({
+ content: `已删除 ${ids.length} 条数据`,
+ status: "success",
+ });
}
});
},
diff --git a/src/views/login/index.vue b/src/views/login/index.vue
index 53b29238..ba13cfba 100644
--- a/src/views/login/index.vue
+++ b/src/views/login/index.vue
@@ -186,7 +186,7 @@
diff --git a/src/views/profile/notice/index.vue b/src/views/profile/notice/index.vue
index dffc85e0..9fb04ddc 100644
--- a/src/views/profile/notice/index.vue
+++ b/src/views/profile/notice/index.vue
@@ -53,7 +53,7 @@
- 已读
+ 已读
未读
diff --git a/src/views/system/dept/index.vue b/src/views/system/dept/index.vue
index 6ced5c19..16fa75c8 100644
--- a/src/views/system/dept/index.vue
+++ b/src/views/system/dept/index.vue
@@ -62,7 +62,7 @@
- 正常
+ 正常
禁用
diff --git a/src/views/system/menu/index.vue b/src/views/system/menu/index.vue
index 62d160a6..41a7c0e2 100644
--- a/src/views/system/menu/index.vue
+++ b/src/views/system/menu/index.vue
@@ -89,7 +89,7 @@
-
+
路由名称
@@ -173,7 +176,7 @@
@@ -191,14 +194,17 @@
-
+
组件路径
@@ -214,12 +220,12 @@
- src/views/
- .vue
+ src/views/
+ .vue
-
+
路由参数
@@ -332,7 +338,7 @@
-
+
@@ -341,7 +347,7 @@
-
+
@@ -529,7 +535,7 @@ function handleSubmit(): void {
if (isValid) {
const menuId = formData.value.id;
if (menuId) {
- if (formData.value.parentId == menuId) {
+ if (formData.value.parentId === menuId) {
ElMessage.error("父级菜单不能为当前菜单");
return;
}
diff --git a/src/views/system/notice/index.vue b/src/views/system/notice/index.vue
index 6c05b622..0e6ba898 100644
--- a/src/views/system/notice/index.vue
+++ b/src/views/system/notice/index.vue
@@ -77,15 +77,15 @@
- 全体
- 指定
+ 全体
+ 指定
- 未发布
- 已发布
- 已撤回
+ 未发布
+ 已发布
+ 已撤回
@@ -111,7 +111,7 @@
查看
指定
-
+
- 未发布
- 已发布
- 已撤回
+ 未发布
+ 已发布
+ 已撤回
{{ currentNotice.publisherName }}