From 4e3995325348e593e1e53bea90bf5dad282db4af Mon Sep 17 00:00:00 2001 From: sansenhoshi Date: Sun, 21 Jun 2026 20:23:36 +0800 Subject: [PATCH] bug fix --- CLAUDE.md | 116 + README.md | 50 - src/components/ren-dept-tree/index.ts | 5 - src/components/ren-radio-group/index.ts | 4 - src/components/ren-region-tree/index.ts | 5 - src/components/ren-select/index.ts | 4 - src/components/sys-dept-tree/index.ts | 5 + .../src/sys-dept-tree.vue} | 0 src/components/sys-radio-group/index.ts | 4 + .../src/sys-radio-group.vue} | 2 +- src/components/sys-region-tree/index.ts | 5 + .../src/sys-region-tree.vue} | 4 +- src/components/sys-select/index.ts | 4 + .../src/sys-select.vue} | 2 +- src/layout/header/base-header.vue | 6 +- src/layout/header/import-task-indicator.vue | 143 + src/main.ts | 8 +- src/store/importTasks.ts | 47 + src/utils/chartBuilder.ts | 36 + src/utils/exportReport.ts | 33 + src/utils/utils.ts | 30 + .../weatherdailydata-add-or-update.vue | 148 +- .../dailyweather/weatherdailydata-import.vue | 94 +- src/views/dailyweather/weatherdailydata.vue | 198 +- src/views/home.vue | 2423 ++++++++++++++--- src/views/login.vue | 4 +- src/views/oss/oss-config.vue | 4 +- .../station/weatherstation-add-or-update.vue | 44 +- src/views/station/weatherstation.vue | 62 +- src/views/sys/user-add-or-update.vue | 10 +- src/views/sys/user.vue | 4 +- src/views/weather/631weather-data.vue | 596 ++++ src/views/weather/prediction.vue | 516 ++++ src/views/weather/realtime-monitoring.vue | 816 ++++++ 34 files changed, 4755 insertions(+), 677 deletions(-) create mode 100644 CLAUDE.md delete mode 100644 src/components/ren-dept-tree/index.ts delete mode 100644 src/components/ren-radio-group/index.ts delete mode 100644 src/components/ren-region-tree/index.ts delete mode 100644 src/components/ren-select/index.ts create mode 100644 src/components/sys-dept-tree/index.ts rename src/components/{ren-dept-tree/src/ren-dept-tree.vue => sys-dept-tree/src/sys-dept-tree.vue} (100%) create mode 100644 src/components/sys-radio-group/index.ts rename src/components/{ren-radio-group/src/ren-radio-group.vue => sys-radio-group/src/sys-radio-group.vue} (96%) create mode 100644 src/components/sys-region-tree/index.ts rename src/components/{ren-region-tree/src/ren-region-tree.vue => sys-region-tree/src/sys-region-tree.vue} (98%) create mode 100644 src/components/sys-select/index.ts rename src/components/{ren-select/src/ren-select.vue => sys-select/src/sys-select.vue} (97%) create mode 100644 src/layout/header/import-task-indicator.vue create mode 100644 src/store/importTasks.ts create mode 100644 src/utils/chartBuilder.ts create mode 100644 src/utils/exportReport.ts create mode 100644 src/views/weather/631weather-data.vue create mode 100644 src/views/weather/prediction.vue create mode 100644 src/views/weather/realtime-monitoring.vue diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..4442a3a --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,116 @@ +# CLAUDE.md + +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. + +## Commands + +- Install dependencies: `npm install` +- Start the Vite dev server: `npm run dev` +- Build production assets: `npm run build` or `npm run build:prod` +- Preview the production build locally: `npm run serve` +- Lint Vue/TS sources with autofix: `npm run lint` +- Type-check the project manually: `npx vue-tsc --noEmit` + +## Tests + +- There is currently no project test script in `package.json` and no repository test suite outside dependency `node_modules`. +- Because no test runner is configured, there is no supported “run a single test” command yet. + +## Stack and runtime model + +- Vite 5 + Vue 3 + TypeScript SPA. +- UI is built with Element Plus and Element Plus icons. +- Routing uses `vue-router` with hash history. +- Global state uses Pinia. +- HTTP is centralized through Axios wrappers in `src/utils/http.ts` and `src/service/baseService.ts`. +- API base URL comes from `VITE_APP_API`, but can be overridden at runtime by `window.SITE_CONFIG.apiURL` (`src/constants/app.ts`). + +## Application bootstrapping + +- `src/main.ts` is the entry point. It mounts the app, installs Pinia/router/Element Plus, and globally registers the reusable `sys-*` selector/tree/radio components. +- `src/constants/app.ts` contains runtime app flags such as API URL, request timeout, keep-alive enablement, and fullscreen pages. + +## Routing and menu architecture + +This app does **not** rely only on static frontend routes. + +- `src/router/base.ts` defines the small set of base routes that always exist: `/`, `/home`, `/login`, password update, iframe, and error pages. +- `src/router/index.ts` performs most of the real routing work in `beforeEach`: + - checks auth token + - initializes app data on first authenticated navigation + - dynamically registers backend-provided routes + - pushes visited routes into the tab system via the event bus +- `useAppStore().initApp()` (`src/store/index.ts`) fetches menus, permissions, user info, and dictionaries from the backend before the app is considered ready. +- `src/utils/router.ts` converts backend menu records into router records: + - maps backend `url` values to Vue files under `src/views` + - handles internal pages vs iframe pages vs “open in new page” links + - flattens nested routes during registration because keep-alive does not support the original multi-level structure well +- `getSysRouteMap()` in `src/router/index.ts` uses `import.meta.glob('/src/views/**/*.vue')`, so backend menu URLs are expected to correspond to files in `src/views` after `toSysViewComponentPath()` normalization. + +When adding a new backend-driven page, the frontend usually needs a matching file in `src/views/...` whose path matches the menu URL convention. + +## State management + +There are two important Pinia stores: + +- `src/store/index.ts` (`useAppStore`): global application state + - login/readiness flags + - permissions + - current user + - dictionaries + - dynamically built routes and route metadata + - tab state +- `src/store/importTasks.ts`: transient UI state for long-running weather data import tasks shown in the header. + +## Layout, tabs, and UI coordination + +The layout framework is event-driven. + +- `src/layout/index.vue` is the main authenticated shell with header, sidebar/mobile sidebar, and content area. +- `src/layout/header/base-header.vue` wires header actions, including the import-task indicator. +- `src/layout/view/base-view.vue` wraps routed pages in `keep-alive` and supports forced tab refresh by changing component keys. +- `src/layout/sidebar/base-sidebar.vue` renders navigation from the dynamically built route tree and adapts across left/top/mixed layouts. +- `src/utils/emits.ts` exports a global `mitt` event bus. +- `src/constants/enum.ts` defines the event names (`EMitt`) and theme/layout enums used across header/sidebar/view coordination. + +If you change navigation, tab refresh, sidebar behavior, or theme/layout switching, trace both the Pinia store and the `mitt` events. + +## HTTP and authentication flow + +- `src/utils/http.ts` owns the Axios instance and interceptors. +- Every request gets the `token` header when present. +- GET requests get an automatic `_t` timestamp query param to avoid caching. +- Business success is defined as `response.data.code === 0`; other codes surface Element Plus error messages. +- HTTP 401 and business-code 401 both redirect to `/login`. +- `src/service/baseService.ts` is the thin CRUD wrapper used throughout views and shared components. + +## Common page pattern + +Many admin-style pages follow the same hook-based CRUD structure. + +- `src/hooks/useView.ts` provides the shared list-page workflow: query, paging, sorting, delete, export, permission checks, dictionary label lookup, and route helpers. +- Views under `src/views/sys`, `src/views/job`, `src/views/oss`, etc. commonly build their page state around this hook rather than reimplementing list behavior. + +Before refactoring one of these screens, check whether the behavior is coming from `useView` rather than the page file itself. + +## Weather-specific feature areas + +The repository has been extended beyond the generic admin shell with weather-focused functionality: + +- `src/views/home.vue` is a large custom analytics dashboard for “historical same-day weather” presentation rather than a simple CRUD page. +- `src/utils/chartBuilder.ts` and `src/utils/exportReport.ts` support chart/report/export behavior used by weather-facing screens. +- `src/views/station/*` manages weather station data. +- `src/views/dailyweather/*` manages daily weather records, including import flows. +- `src/views/dailyweather/weatherdailydata-import.vue` uploads Excel files and polls backend task progress. +- `src/layout/header/import-task-indicator.vue` + `src/store/importTasks.ts` expose those long-running import tasks in the global header. + +## Component conventions worth knowing + +- The reusable selector/tree controls are registered globally in `src/main.ts` and imported from `src/components/sys-*`. +- Some files still use legacy `Ren*` local variable names while importing `sys-*` components; this is naming drift, not a separate component family. +- SVG icons are loaded through `vite-plugin-svg-icons` from `src/assets/icons/svg` and registered by `virtual:svg-icons-register`. + +## Repository notes + +- There is no existing `.cursorrules`, `.cursor/rules/`, or `.github/copilot-instructions.md` content to carry forward. +- `README.md` currently does not contain substantive project guidance, so the main operational context lives in code and this file. diff --git a/README.md b/README.md index 5bbfac6..e69de29 100644 --- a/README.md +++ b/README.md @@ -1,50 +0,0 @@ -## renren-ui -- renren-ui是基于Vue3、TypeScript、Element Plus、Vue Router、Pinia、Axios、Vite等开发,实现 【[renren-security](https://gitee.com/renrenio/renren-security)】 后台管理前端功能,提供一套更优的前端解决方案 -- 前后端分离,通过token进行数据交互,可独立部署 -- 动态菜单,通过菜单管理统一管理访问路由 -- 后端地址:https://gitee.com/renrenio/renren-security -- 演示地址:http://demo.open.renren.io/renren-security (账号密码:admin/admin) - -
- -![输入图片说明](public/1.png) - -## 安装 - -您需要提前在本地安装[Node.js](https://nodejs.org/en/),版本号为:[18、20],再使用[Git](https://git-scm.com/)克隆项目或者直接下载项目后,然后通过`终端命令行`执行以下命令。 - -```bash -# 切换到项目根目录 - -# 安装插件 -npm install - -# 启动项目 -npm run dev -``` - -> 如网络不稳定,安装时出错或进度过慢!请移步 [cnpm](https://npmmirror.com/) 淘宝镜像进行安装。 - -启动完成后,会自动打开浏览器访问 [http://localhost:8001](http://localhost:8001),如您看到下面的页面代表`前端项目`运行成功!因为前后端分离项目,需保证`前端项目`和`后台项目`分别独立正常运行。 - -请留意下面的页面,其中`验证码`未能正常显示,控制台有`API请求`报错信息!这时需检查`后台项目`是否正常运行。 - - - -## 如何交流、反馈、参与贡献? -- 开发文档:https://www.renren.io/guide/security -- 官方社区:https://www.renren.io/community -- [人人开源](https://www.renren.io):https://www.renren.io -- 如需关注项目最新动态,请Watch、Star项目,同时也是对项目最好的支持 -- 技术讨论、二次开发等咨询、问题和建议,请移步到官方社区,我会在第一时间进行解答和回复! -- 微信扫码并关注【人人开源】,获得项目最新动态及更新提醒
- -
- -## 微信交流群 -我们提供了微信交流群,扫码下面的二维码,关注【人人开源】公众号,回复【加群】,即可根据提示加入微信群! -

-![输入图片说明](public/wechat.jpg) - -
-
diff --git a/src/components/ren-dept-tree/index.ts b/src/components/ren-dept-tree/index.ts deleted file mode 100644 index 91593ef..0000000 --- a/src/components/ren-dept-tree/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { withInstall } from "@/utils/utils"; -import RenDeptTree from "./src/ren-dept-tree.vue"; - -RenDeptTree.name = "RenDeptTree"; -export default withInstall(RenDeptTree); diff --git a/src/components/ren-radio-group/index.ts b/src/components/ren-radio-group/index.ts deleted file mode 100644 index d9bcc95..0000000 --- a/src/components/ren-radio-group/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { withInstall } from "@/utils/utils"; -import RenRadioGroup from "./src/ren-radio-group.vue"; - -export default withInstall(RenRadioGroup); diff --git a/src/components/ren-region-tree/index.ts b/src/components/ren-region-tree/index.ts deleted file mode 100644 index 4255fbb..0000000 --- a/src/components/ren-region-tree/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { withInstall } from "@/utils/utils"; -import RenRegionTree from "./src/ren-region-tree.vue"; - -RenRegionTree.name = "RenRegionTree"; -export default withInstall(RenRegionTree); diff --git a/src/components/ren-select/index.ts b/src/components/ren-select/index.ts deleted file mode 100644 index 47267ab..0000000 --- a/src/components/ren-select/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { withInstall } from "@/utils/utils"; -import RenSelect from "./src/ren-select.vue"; - -export default withInstall(RenSelect); diff --git a/src/components/sys-dept-tree/index.ts b/src/components/sys-dept-tree/index.ts new file mode 100644 index 0000000..b4c6e8b --- /dev/null +++ b/src/components/sys-dept-tree/index.ts @@ -0,0 +1,5 @@ +import { withInstall } from "@/utils/utils"; +import SysDeptTree from "./src/sys-dept-tree.vue"; + +SysDeptTree.name = "SysDeptTree"; +export default withInstall(SysDeptTree); diff --git a/src/components/ren-dept-tree/src/ren-dept-tree.vue b/src/components/sys-dept-tree/src/sys-dept-tree.vue similarity index 100% rename from src/components/ren-dept-tree/src/ren-dept-tree.vue rename to src/components/sys-dept-tree/src/sys-dept-tree.vue diff --git a/src/components/sys-radio-group/index.ts b/src/components/sys-radio-group/index.ts new file mode 100644 index 0000000..95e7345 --- /dev/null +++ b/src/components/sys-radio-group/index.ts @@ -0,0 +1,4 @@ +import { withInstall } from "@/utils/utils"; +import SysRadioGroup from "./src/sys-radio-group.vue"; + +export default withInstall(SysRadioGroup); diff --git a/src/components/ren-radio-group/src/ren-radio-group.vue b/src/components/sys-radio-group/src/sys-radio-group.vue similarity index 96% rename from src/components/ren-radio-group/src/ren-radio-group.vue rename to src/components/sys-radio-group/src/sys-radio-group.vue index 4de2d8c..ca8709e 100644 --- a/src/components/ren-radio-group/src/ren-radio-group.vue +++ b/src/components/sys-radio-group/src/sys-radio-group.vue @@ -8,7 +8,7 @@ import { getDictDataList } from "@/utils/utils"; import { computed, defineComponent } from "vue"; import { useAppStore } from "@/store"; export default defineComponent({ - name: "RenRadioGroup", + name: "SysRadioGroup", props: { modelValue: [Number, String], dictType: String diff --git a/src/components/sys-region-tree/index.ts b/src/components/sys-region-tree/index.ts new file mode 100644 index 0000000..9408ef4 --- /dev/null +++ b/src/components/sys-region-tree/index.ts @@ -0,0 +1,5 @@ +import { withInstall } from "@/utils/utils"; +import SysRegionTree from "./src/sys-region-tree.vue"; + +SysRegionTree.name = "SysRegionTree"; +export default withInstall(SysRegionTree); diff --git a/src/components/ren-region-tree/src/ren-region-tree.vue b/src/components/sys-region-tree/src/sys-region-tree.vue similarity index 98% rename from src/components/ren-region-tree/src/ren-region-tree.vue rename to src/components/sys-region-tree/src/sys-region-tree.vue index 9eebee5..e6cd5da 100644 --- a/src/components/ren-region-tree/src/ren-region-tree.vue +++ b/src/components/sys-region-tree/src/sys-region-tree.vue @@ -1,5 +1,5 @@