From cd72290d06a877a4f197391583fa5533ea9e85ee Mon Sep 17 00:00:00 2001 From: ray <1490493387@qq.com> Date: Wed, 12 Feb 2025 13:40:27 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20:recycle:=20=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E8=A7=84=E8=8C=83=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 32 +++++++++---------- commitlint.config.cjs | 4 +-- src/components/CURD/PageContent.vue | 3 +- src/components/CURD/PageForm.vue | 6 ++-- src/components/CURD/PageModal.vue | 8 ++--- src/components/TableSelect/index.vue | 6 ++-- src/components/Upload/FileUpload.vue | 8 +++-- src/components/Upload/MultiImageUpload.vue | 2 +- .../NavBar/components/NavbarRight.vue | 8 ++--- .../Sidebar/components/SidebarMenuItem.vue | 4 +-- src/layout/components/Sidebar/index.vue | 10 +++--- src/layout/components/TagsView/index.vue | 24 +++++--------- src/layout/index.vue | 27 ++++++++-------- src/styles/reset.scss | 4 +-- src/utils/request.ts | 24 +++++++------- src/views/codegen/index.vue | 3 +- src/views/dashboard/index.vue | 1 - src/views/error/404.vue | 2 +- src/views/profile/index.vue | 7 ++-- src/views/system/config/index.vue | 4 +-- src/views/system/dept/index.vue | 4 +-- src/views/system/dict/data.vue | 4 +-- src/views/system/dict/index.vue | 8 ++--- src/views/system/log/index.vue | 2 +- src/views/system/menu/index.vue | 4 +-- .../system/notice/components/MyNotice.vue | 2 +- src/views/system/notice/index.vue | 4 +-- src/views/system/role/index.vue | 6 ++-- src/views/system/user/components/DeptTree.vue | 2 +- .../system/user/components/UserImport.vue | 5 +-- src/views/system/user/index.vue | 5 ++- 31 files changed, 113 insertions(+), 120 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fd2cef30..aef3f6da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ ## ✨ feat -- 支持后端文件导入([#142](https://github.com/youlaitech/vue3-element-admin/pull/142)) [@cshaptx4869](https://github.com/cshaptx4869) +- 支持后端文件导入([#142](https://github.com/youlaitech/vue3-element-admin/pull/142)) [@cshaptx4869](https://github.com/cshaptx4869) ## 🐛 fix @@ -15,7 +15,7 @@ ## ✨ feat -- 操作栏增加render配置参数([#138](https://github.com/youlaitech/vue3-element-admin/pull/140)) [@cshaptx4869](https://github.com/cshaptx4869) +- 操作栏增加render配置参数([#138](https://github.com/youlaitech/vue3-element-admin/pull/140)) [@cshaptx4869](https://github.com/cshaptx4869) - 左侧工具栏增加type配置参数([#141](https://github.com/youlaitech/vue3-element-admin/pull/141)) [@diamont1001](https://github.com/diamont1001) ## ♻️ refactor @@ -27,7 +27,7 @@ ## ✨ feat -- 支持默认工具栏的导入([#138](https://github.com/youlaitech/vue3-element-admin/pull/138)) [@cshaptx4869](https://github.com/cshaptx4869) +- 支持默认工具栏的导入([#138](https://github.com/youlaitech/vue3-element-admin/pull/138)) [@cshaptx4869](https://github.com/cshaptx4869) - 添加CURD导入示例([19e7bb](https://github.com/youlaitech/vue3-element-admin/commit/eab91effd6a01d5a3d9257249c8d06aa252b3bf8)) [@cshaptx4869](https://github.com/cshaptx4869) ## ♻️ refactor @@ -40,13 +40,13 @@ ## ✨ feat -- 支持表格远程筛选([#131](https://github.com/youlaitech/vue3-element-admin/pull/131)) [@cshaptx4869](https://github.com/cshaptx4869) +- 支持表格远程筛选([#131](https://github.com/youlaitech/vue3-element-admin/pull/131)) [@cshaptx4869](https://github.com/cshaptx4869) - 支持标签输入框([#132](https://github.com/youlaitech/vue3-element-admin/pull/132)) [@cshaptx4869](https://github.com/cshaptx4869) -- 表单项支持tips配置([#133](https://github.com/youlaitech/vue3-element-admin/pull/133)) [@cshaptx4869](https://github.com/cshaptx4869) -- 前端导出支持全量数据([#134](https://github.com/youlaitech/vue3-element-admin/pull/134)) [@cshaptx4869](https://github.com/cshaptx4869) -- 支持选中数据导出([#135](https://github.com/youlaitech/vue3-element-admin/pull/135)) [@cshaptx4869](https://github.com/cshaptx4869) -- 表格默认工具栏的导出、搜索按钮增加权限点控制([883128](https://github.com/youlaitech/vue3-element-admin/commit/8831289b655f2cc086ecdababaa89f8d8a087c42)) [@cshaptx4869](https://github.com/cshaptx4869) -- 页签title支持动态设置([23876a](https://github.com/youlaitech/vue3-element-admin/commit/23876aa396143bf77cb5c86af8d6023d9ff6555a)) [@haoxianrui](https://github.com/haoxianrui) +- 表单项支持tips配置([#133](https://github.com/youlaitech/vue3-element-admin/pull/133)) [@cshaptx4869](https://github.com/cshaptx4869) +- 前端导出支持全量数据([#134](https://github.com/youlaitech/vue3-element-admin/pull/134)) [@cshaptx4869](https://github.com/cshaptx4869) +- 支持选中数据导出([#135](https://github.com/youlaitech/vue3-element-admin/pull/135)) [@cshaptx4869](https://github.com/cshaptx4869) +- 表格默认工具栏的导出、搜索按钮增加权限点控制([883128](https://github.com/youlaitech/vue3-element-admin/commit/8831289b655f2cc086ecdababaa89f8d8a087c42)) [@cshaptx4869](https://github.com/cshaptx4869) +- 页签title支持动态设置([23876a](https://github.com/youlaitech/vue3-element-admin/commit/23876aa396143bf77cb5c86af8d6023d9ff6555a)) [@haoxianrui](https://github.com/haoxianrui) ## ♻️ refactor - 默认工具栏支持自定义([#136](https://github.com/youlaitech/vue3-element-admin/pull/136)) [@cshaptx4869](https://github.com/cshaptx4869) @@ -59,9 +59,9 @@ ## ✨ feat -- 增加pagination、request、parseData配置参数([#119](https://github.com/youlaitech/vue3-element-admin/pull/119)) [@cshaptx4869](https://github.com/cshaptx4869) +- 增加pagination、request、parseData配置参数([#119](https://github.com/youlaitech/vue3-element-admin/pull/119)) [@cshaptx4869](https://github.com/cshaptx4869) - 增加返回顶部功能([#120](https://github.com/youlaitech/vue3-element-admin/pull/120)) [@cshaptx4869](https://github.com/cshaptx4869) -- 支持前端导出([#126](https://github.com/youlaitech/vue3-element-admin/pull/126)) [@cshaptx4869](https://github.com/cshaptx4869) +- 支持前端导出([#126](https://github.com/youlaitech/vue3-element-admin/pull/126)) [@cshaptx4869](https://github.com/cshaptx4869) ## ♻️ refactor - 重构布局样式(解决页面抖动问题)([#116](https://github.com/youlaitech/vue3-element-admin/pull/116)) [@cshaptx4869](https://github.com/cshaptx4869) @@ -174,7 +174,7 @@ - 本地缓存的 token 变量重命名(author by [haoxianrui](https://github.com/haoxianrui)) - 完善 Vite 环境变量类型声明(author by [haoxianrui](https://github.com/haoxianrui)) -## 🐛 fix +## 🐛 fix - 修复构建时提示iconComponent.name可能为undefined的报错 (author by [wangji1042](https://github.com/wangji1042)) - 修复浏览器密码自动填充时可能存在的报错 (author by [cshaptx4869](https://github.com/cshaptx4869)) - 修复eslint报错(author by [cshaptx4869](https://github.com/cshaptx4869)) @@ -211,7 +211,7 @@ ## ♻️ refactor - 项目配置按钮移入navbar(author by [cshaptx4869](https://github.com/cshaptx4869)) - 优化user数据定义(author by [cshaptx4869](https://github.com/cshaptx4869)) -- 统一设置栏的 SVG 图标风格 +- 统一设置栏的 SVG 图标风格 ## 🐛 fix - 规整一些开发依赖(author by [cshaptx4869](https://github.com/cshaptx4869)) @@ -241,7 +241,7 @@ # 2.8.1 (2024/01/10) ## ✨ feat -- 替换 Mock 解决方案 vite-plugin-mock 为 vite-plugin-mock-dev-server 适配 Vite5 +- 替换 Mock 解决方案 vite-plugin-mock 为 vite-plugin-mock-dev-server 适配 Vite5 # 2.8.0 (2023/12/27) @@ -280,7 +280,7 @@ ## ✨ feat - 菜单管理新增目录只有一级子路由是否始终显示(alwaysShow)和路由页面是否缓存(keepAlive)的配置 - 接口文档新增 swagger、knife4j -- 引入和支持 tsx +- 引入和支持 tsx ## ♻️ refactor - 代码瘦身,整理并删除未使用的 svg @@ -329,7 +329,7 @@ - 字典组件封装(author by [haoxr](https://juejin.cn/user/4187394044331261/posts)) ## 🐛 fix -- 分页组件hidden无效 +- 分页组件hidden无效 - 签名无法保存至后端 - Git 提交 stylelint 校验部分机器报错 diff --git a/commitlint.config.cjs b/commitlint.config.cjs index 4ecb995f..5f556e2c 100644 --- a/commitlint.config.cjs +++ b/commitlint.config.cjs @@ -74,9 +74,7 @@ module.exports = { breaklineNumber: 100, breaklineChar: "|", skipQuestions: [], - issuePrefixes: [ - { value: "closed", name: "closed: ISSUES has been processed" }, - ], + issuePrefixes: [{ value: "closed", name: "closed: ISSUES has been processed" }], customIssuePrefixAlign: "top", emptyIssuePrefixAlias: "skip", customIssuePrefixAlias: "custom", diff --git a/src/components/CURD/PageContent.vue b/src/components/CURD/PageContent.vue index 44f46bb4..a65e3c78 100644 --- a/src/components/CURD/PageContent.vue +++ b/src/components/CURD/PageContent.vue @@ -586,6 +586,7 @@ cols.value.forEach((item) => { fields.push(item.prop); } }); + const enum ExportsOriginEnum { CURRENT = "current", SELECTED = "selected", @@ -950,7 +951,7 @@ function exportPageData(formData: IObject = {}) { } // 浏览器保存文件 -function saveXlsx(fileData: BlobPart, fileName: string) { +function saveXlsx(fileData: any, fileName: string) { const fileType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8"; diff --git a/src/components/CURD/PageForm.vue b/src/components/CURD/PageForm.vue index 199f4041..7fff077b 100644 --- a/src/components/CURD/PageForm.vue +++ b/src/components/CURD/PageForm.vue @@ -69,7 +69,7 @@ @@ -137,11 +137,11 @@ function getFormData(key?: string) { // 设置表单值 function setFormData(data: IObject) { for (const key in formData) { - if (formData.hasOwnProperty(key) && key in data) { + if (Object.prototype.hasOwnProperty.call(formData, key) && key in data) { formData[key] = data[key]; } } - if (data?.hasOwnProperty(props.pk)) { + if (Object.prototype.hasOwnProperty.call(data, props.pk)) { formData[props.pk] = data[props.pk]; } } diff --git a/src/components/CURD/PageModal.vue b/src/components/CURD/PageModal.vue index 87465d69..e2e3f2c7 100644 --- a/src/components/CURD/PageModal.vue +++ b/src/components/CURD/PageModal.vue @@ -90,7 +90,7 @@ @@ -208,7 +208,7 @@ @@ -294,11 +294,11 @@ function getFormData(key?: string) { // 设置表单值 function setFormData(data: IObject) { for (const key in formData) { - if (formData.hasOwnProperty(key) && key in data) { + if (Object.prototype.hasOwnProperty.call(formData, key) && key in data) { formData[key] = data[key]; } } - if (data?.hasOwnProperty(pk)) { + if (Object.prototype.hasOwnProperty.call(data, pk)) { formData[pk] = data[pk]; } } diff --git a/src/components/TableSelect/index.vue b/src/components/TableSelect/index.vue index 54fc7630..95fb808b 100644 --- a/src/components/TableSelect/index.vue +++ b/src/components/TableSelect/index.vue @@ -143,7 +143,7 @@ diff --git a/src/layout/components/TagsView/index.vue b/src/layout/components/TagsView/index.vue index b672db25..38947e3c 100644 --- a/src/layout/components/TagsView/index.vue +++ b/src/layout/components/TagsView/index.vue @@ -187,25 +187,17 @@ function isAffix(tag: TagView) { } function isFirstView() { - try { - return ( - selectedTag.value.path === "/dashboard" || - selectedTag.value.fullPath === tagsViewStore.visitedViews[1].fullPath - ); - } catch (err) { - return false; - } + return ( + selectedTag.value.path === "/dashboard" || + selectedTag.value.fullPath === tagsViewStore.visitedViews[1]?.fullPath + ); } function isLastView() { - try { - return ( - selectedTag.value.fullPath === - tagsViewStore.visitedViews[tagsViewStore.visitedViews.length - 1].fullPath - ); - } catch (err) { - return false; - } + return ( + selectedTag.value.fullPath === + tagsViewStore.visitedViews[tagsViewStore.visitedViews.length - 1]?.fullPath + ); } function refreshSelectedTag(view: TagView) { diff --git a/src/layout/index.vue b/src/layout/index.vue index a75570c1..1f709c5a 100644 --- a/src/layout/index.vue +++ b/src/layout/index.vue @@ -21,8 +21,8 @@ -
- +
+ @@ -33,9 +33,9 @@
-
+
- + @@ -62,7 +62,7 @@ const width = useWindowSize().width; const WIDTH_DESKTOP = 992; // 响应式布局容器固定宽度 大屏(>=1200px) 中屏(>=992px) 小屏(>=768px) const isMobile = computed(() => appStore.device === DeviceEnum.MOBILE); const isOpenSidebar = computed(() => appStore.sidebar.opened); -const showTagsView = computed(() => settingsStore.tagsView); // 是否显示tagsView +const isShowTagsView = computed(() => settingsStore.tagsView); // 是否显示tagsView const layout = computed(() => settingsStore.layout); // 布局模式 left top mix const activeTopMenuPath = computed(() => appStore.activeTopMenuPath); // 顶部菜单激活path const mixedLayoutLeftRoutes = computed(() => permissionStore.mixedLayoutLeftRoutes); // 混合布局左侧菜单 @@ -245,8 +245,10 @@ watch(route, () => { } .hideSidebar { - .main-container { - margin-left: $sidebar-width-collapsed; + &.layout-left { + .main-container { + margin-left: $sidebar-width-collapsed; + } } &.layout-top { @@ -280,7 +282,7 @@ watch(route, () => { &.mobile { .sidebar-container { pointer-events: none; - transform: translate3d(-210px, 0, 0); + transform: translate3d(-$sidebar-width, 0, 0); transition-duration: 0.3s; } @@ -291,13 +293,10 @@ watch(route, () => { } .mobile { - .main-container { + .layout-mix, + .layout-top, + .layout-left { margin-left: 0; } - - &.layout-top { - // 顶部模式全局变量修改 - --el-menu-item-height: $navbar-height; - } } diff --git a/src/styles/reset.scss b/src/styles/reset.scss index a20f04a5..56689def 100644 --- a/src/styles/reset.scss +++ b/src/styles/reset.scss @@ -25,8 +25,8 @@ body { width: 100%; height: 100%; margin: 0; - font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", - "Microsoft YaHei", "微软雅黑", Arial, sans-serif; + font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", + "微软雅黑", Arial, sans-serif; line-height: inherit; -moz-osx-font-smoothing: grayscale; -webkit-font-smoothing: antialiased; diff --git a/src/utils/request.ts b/src/utils/request.ts index 1a8211dc..fb797d30 100644 --- a/src/utils/request.ts +++ b/src/utils/request.ts @@ -44,7 +44,8 @@ service.interceptors.response.use( ElMessage.error(msg || "系统出错"); return Promise.reject(new Error(msg || "Error")); }, - async (error: any) => { + async (error) => { + console.error("request error", error); // for debug // 非 2xx 状态码处理 401、403、500 等 const { config, response } = error; if (response) { @@ -64,20 +65,21 @@ service.interceptors.response.use( export default service; -// 刷新 Token 的锁 +// 是否正在刷新标识,避免重复刷新 let isRefreshing = false; -// 因 Token 过期导致失败的请求队列 -let requestsQueue: Array<() => void> = []; +// 因 Token 过期导致的请求等待队列 +const waitingQueue: Array<() => void> = []; // 刷新 Token 处理 async function handleTokenRefresh(config: InternalAxiosRequestConfig) { return new Promise((resolve) => { - const requestCallback = () => { + // 封装需要重试的请求 + const retryRequest = () => { config.headers.Authorization = getToken(); resolve(service(config)); }; - requestsQueue.push(requestCallback); + waitingQueue.push(retryRequest); if (!isRefreshing) { isRefreshing = true; @@ -86,13 +88,13 @@ async function handleTokenRefresh(config: InternalAxiosRequestConfig) { useUserStoreHook() .refreshToken() .then(() => { - // Token 刷新成功,执行请求队列 - requestsQueue.forEach((callback) => callback()); - requestsQueue = []; + // 依次重试队列中所有请求, 重试后清空队列 + waitingQueue.forEach((callback) => callback()); + waitingQueue.length = 0; }) - .catch((error) => { + .catch((error: any) => { console.log("handleTokenRefresh error", error); - // Token 刷新失败,清除用户数据并跳转到登录 + // 刷新 Token 失败,跳转登录页 ElNotification({ title: "提示", message: "您的会话已过期,请重新登录", diff --git a/src/views/codegen/index.vue b/src/views/codegen/index.vue index d961912f..66809295 100644 --- a/src/views/codegen/index.vue +++ b/src/views/codegen/index.vue @@ -437,7 +437,7 @@ interface TreeNode { } const treeData = ref([]); -const queryFormRef = ref(ElForm); +const queryFormRef = ref(); const queryParams = reactive({ pageNum: 1, pageSize: 10, @@ -535,7 +535,6 @@ const initSort = () => { ghostClass: "sortable-ghost", //拖拽样式 handle: ".sortable-handle", //拖拽区域 easing: "cubic-bezier(1, 0, 0, 1)", - onStart: (item: any) => {}, // 结束拖动事件 onEnd: (item: any) => { diff --git a/src/views/dashboard/index.vue b/src/views/dashboard/index.vue index 1915f2c5..f2621f78 100644 --- a/src/views/dashboard/index.vue +++ b/src/views/dashboard/index.vue @@ -236,7 +236,6 @@ defineOptions({ name: "Dashboard", inheritAttrs: false, }); - import VisitTrend from "./components/visit-trend.vue"; import router from "@/router"; diff --git a/src/views/error/404.vue b/src/views/error/404.vue index 005c09eb..efd7e393 100644 --- a/src/views/error/404.vue +++ b/src/views/error/404.vue @@ -89,8 +89,8 @@ function back() { } &__return-home { - display: block; float: left; + display: block; width: 110px; height: 36px; font-size: 14px; diff --git a/src/views/profile/index.vue b/src/views/profile/index.vue index 3af1cd20..68b4e7c5 100644 --- a/src/views/profile/index.vue +++ b/src/views/profile/index.vue @@ -268,7 +268,7 @@ import { Camera } from "@element-plus/icons-vue"; const userProfile = ref({}); -enum DialogType { +const enum DialogType { ACCOUNT = "account", PASSWORD = "password", MOBILE = "mobile", @@ -287,10 +287,10 @@ const mobileUpdateForm = reactive({}); const emailUpdateForm = reactive({}); const mobileCountdown = ref(0); -const mobileTimer = ref(null); +const mobileTimer = ref(); const emailCountdown = ref(0); -const emailTimer = ref(null); +const emailTimer = ref(); // 修改密码校验规则 const passwordChangeRules = { @@ -466,6 +466,7 @@ const handleFileChange = async (event: Event) => { avatar: data.url, }); } catch (error) { + console.error("头像上传失败:" + error); ElMessage.error("头像上传失败"); } } diff --git a/src/views/system/config/index.vue b/src/views/system/config/index.vue index 0955806f..034efa23 100644 --- a/src/views/system/config/index.vue +++ b/src/views/system/config/index.vue @@ -137,8 +137,8 @@ defineOptions({ import ConfigAPI, { ConfigPageVO, ConfigForm, ConfigPageQuery } from "@/api/system/config"; -const queryFormRef = ref(ElForm); -const dataFormRef = ref(ElForm); +const queryFormRef = ref(); +const dataFormRef = ref(); const loading = ref(false); const selectIds = ref([]); diff --git a/src/views/system/dept/index.vue b/src/views/system/dept/index.vue index 9ecc354a..45a39a2d 100644 --- a/src/views/system/dept/index.vue +++ b/src/views/system/dept/index.vue @@ -160,8 +160,8 @@ defineOptions({ import DeptAPI, { DeptVO, DeptForm, DeptQuery } from "@/api/system/dept"; -const queryFormRef = ref(ElForm); -const deptFormRef = ref(ElForm); +const queryFormRef = ref(); +const deptFormRef = ref(); const loading = ref(false); const selectIds = ref([]); diff --git a/src/views/system/dict/data.vue b/src/views/system/dict/data.vue index 2f7a3c65..e8cf6253 100644 --- a/src/views/system/dict/data.vue +++ b/src/views/system/dict/data.vue @@ -144,8 +144,8 @@ const route = useRoute(); const dictCode = ref(route.query.dictCode as string); -const queryFormRef = ref(ElForm); -const dataFormRef = ref(ElForm); +const queryFormRef = ref(); +const dataFormRef = ref(); const loading = ref(false); const ids = ref([]); diff --git a/src/views/system/dict/index.vue b/src/views/system/dict/index.vue index 32517f01..39260418 100644 --- a/src/views/system/dict/index.vue +++ b/src/views/system/dict/index.vue @@ -57,7 +57,7 @@ link size="small" icon="edit" - @click.stop="handleEditClick(scope.row.id, scope.row.name)" + @click.stop="handleEditClick(scope.row.id)" > 编辑 @@ -133,8 +133,8 @@ import DictAPI, { DictPageQuery, DictPageVO, DictForm } from "@/api/system/dict" import router from "@/router"; -const queryFormRef = ref(ElForm); -const dataFormRef = ref(ElForm); +const queryFormRef = ref(); +const dataFormRef = ref(); const loading = ref(false); const ids = ref([]); @@ -198,7 +198,7 @@ function handleAddClick() { * * @param id 字典ID */ -function handleEditClick(id: number, name: string) { +function handleEditClick(id: number) { dialog.visible = true; dialog.title = "修改字典"; DictAPI.getFormData(id).then((data) => { diff --git a/src/views/system/log/index.vue b/src/views/system/log/index.vue index 13cca4ef..f0b8367c 100644 --- a/src/views/system/log/index.vue +++ b/src/views/system/log/index.vue @@ -62,7 +62,7 @@ defineOptions({ import LogAPI, { LogPageVO, LogPageQuery } from "@/api/system/log"; -const queryFormRef = ref(ElForm); +const queryFormRef = ref(); const loading = ref(false); const total = ref(0); diff --git a/src/views/system/menu/index.vue b/src/views/system/menu/index.vue index 60cd0854..23bab330 100644 --- a/src/views/system/menu/index.vue +++ b/src/views/system/menu/index.vue @@ -338,8 +338,8 @@ defineOptions({ import MenuAPI, { MenuQuery, MenuForm, MenuVO } from "@/api/system/menu"; import { MenuTypeEnum } from "@/enums/MenuTypeEnum"; -const queryFormRef = ref(ElForm); -const menuFormRef = ref(ElForm); +const queryFormRef = ref(); +const menuFormRef = ref(); const loading = ref(false); const dialog = reactive({ diff --git a/src/views/system/notice/components/MyNotice.vue b/src/views/system/notice/components/MyNotice.vue index 9aa09bec..e8900b30 100644 --- a/src/views/system/notice/components/MyNotice.vue +++ b/src/views/system/notice/components/MyNotice.vue @@ -87,7 +87,7 @@ defineOptions({ import NoticeAPI, { NoticePageVO, NoticePageQuery } from "@/api/system/notice"; -const queryFormRef = ref(ElForm); +const queryFormRef = ref(); const noticeDetailRef = ref(); const pageData = ref([]); diff --git a/src/views/system/notice/index.vue b/src/views/system/notice/index.vue index eb40926d..b6980f00 100644 --- a/src/views/system/notice/index.vue +++ b/src/views/system/notice/index.vue @@ -223,8 +223,8 @@ defineOptions({ import NoticeAPI, { NoticePageVO, NoticeForm, NoticePageQuery } from "@/api/system/notice"; import UserAPI from "@/api/system/user"; -const queryFormRef = ref(ElForm); -const dataFormRef = ref(ElForm); +const queryFormRef = ref(); +const dataFormRef = ref(); const noticeDetailRef = ref(); const loading = ref(false); diff --git a/src/views/system/role/index.vue b/src/views/system/role/index.vue index 3f279355..4730579c 100644 --- a/src/views/system/role/index.vue +++ b/src/views/system/role/index.vue @@ -211,9 +211,9 @@ defineOptions({ import RoleAPI, { RolePageVO, RoleForm, RolePageQuery } from "@/api/system/role"; import MenuAPI from "@/api/system/menu"; -const queryFormRef = ref(ElForm); -const roleFormRef = ref(ElForm); -const permTreeRef = ref>(); +const queryFormRef = ref(); +const roleFormRef = ref(); +const permTreeRef = ref(); const loading = ref(false); const ids = ref([]); diff --git a/src/views/system/user/components/DeptTree.vue b/src/views/system/user/components/DeptTree.vue index 9558f36e..5fcfe452 100644 --- a/src/views/system/user/components/DeptTree.vue +++ b/src/views/system/user/components/DeptTree.vue @@ -30,7 +30,7 @@ const props = defineProps({ }); const deptList = ref(); // 部门列表 -const deptTreeRef = ref(ElTree); // 部门树 +const deptTreeRef = ref(); // 部门树 const deptName = ref(); // 部门名称 const emits = defineEmits(["node-click"]); diff --git a/src/views/system/user/components/UserImport.vue b/src/views/system/user/components/UserImport.vue index 573bdca6..923bc384 100644 --- a/src/views/system/user/components/UserImport.vue +++ b/src/views/system/user/components/UserImport.vue @@ -175,8 +175,9 @@ const handleUpload = async () => { invalidCount.value = result.invalidCount; validCount.value = result.validCount; } - } catch (error) { - ElMessage.error("上传失败"); + } catch (error: any) { + console.error(error); + ElMessage.error("上传失败:" + error); } }; diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue index f25996bb..7e651331 100644 --- a/src/views/system/user/index.vue +++ b/src/views/system/user/index.vue @@ -249,9 +249,8 @@ defineOptions({ name: "User", inheritAttrs: false, }); - -const queryFormRef = ref(ElForm); -const userFormRef = ref(ElForm); +const queryFormRef = ref(); +const userFormRef = ref(); const queryParams = reactive({ pageNum: 1,