cc 2 mesiacov pred
rodič
commit
0efd2e4f0b
37 zmenil súbory, kde vykonal 1048 pridanie a 1085 odobranie
  1. 113 0
      .workbuddy/memory/2026-09-16.md
  2. 1 7
      ai-frontend/src/case/api/govern/governApi.ts
  3. 22 20
      ai-frontend/src/case/views/dm/components/StationMapModal.vue
  4. 18 5
      ai-frontend/src/core/api/sys/login.ts
  5. 3 8
      ai-frontend/src/core/components/Application/src/AppLogo.vue
  6. 0 44
      ai-frontend/src/core/hooks/electron/useElectronWindow.ts
  7. 0 21
      ai-frontend/src/core/layouts/default/header/components/WindowClose.vue
  8. 0 23
      ai-frontend/src/core/layouts/default/header/components/WindowControls.vue
  9. 0 21
      ai-frontend/src/core/layouts/default/header/components/WindowMaximize.vue
  10. 0 20
      ai-frontend/src/core/layouts/default/header/components/WindowMinimize.vue
  11. 0 7
      ai-frontend/src/core/layouts/default/header/components/index.ts
  12. 1 16
      ai-frontend/src/core/layouts/default/header/index.vue
  13. 17 11
      ai-frontend/src/core/layouts/default/setting/api.ts
  14. 0 209
      ai-frontend/src/core/layouts/default/setting/components/CellLocalModal.vue
  15. 0 189
      ai-frontend/src/core/layouts/default/setting/components/OfflineMapModal.vue
  16. 3 8
      ai-frontend/src/core/layouts/default/setting/components/ProductInfoModal.vue
  17. 1 45
      ai-frontend/src/core/layouts/default/setting/components/SettingFooter.vue
  18. 53 27
      ai-frontend/src/core/layouts/default/setting/components/UpgradeModal.vue
  19. 0 2
      ai-frontend/src/core/layouts/default/setting/components/index.ts
  20. 7 6
      ai-frontend/src/core/logics/caseConfigGuide.ts
  21. 0 63
      ai-frontend/src/core/utils/caseGlobalConfig.ts
  22. 64 54
      ai-frontend/src/core/utils/map/offlineMap.ts
  23. 24 0
      ai-frontend/src/graph/api/analysis.ts
  24. 37 57
      ai-frontend/src/graph/views/graph/index.vue
  25. 29 36
      ai-frontend/src/plat/views/authorization/index.vue
  26. 1 6
      ai-frontend/src/plat/views/case/case.vue
  27. 25 1
      ai-frontend/src/trans/api/baseStationQueryApi.ts
  28. 22 21
      ai-frontend/src/trans/views/aiBaseStation/components/BaseStationQueryMap.vue
  29. 54 100
      ai-frontend/src/trans/views/aiBaseStation/index.vue
  30. 22 20
      ai-frontend/src/trans/views/behaviorSpacetime/index.vue
  31. 25 0
      ai-server/src/main/java/com/zsjz/ai/module/graph/controller/GraphController.java
  32. 50 0
      ai-server/src/main/java/com/zsjz/ai/module/graph/service/GraphService.java
  33. 44 12
      ai-server/src/main/java/com/zsjz/ai/module/plat/controller/SystemController.java
  34. 27 8
      ai-server/src/main/java/com/zsjz/ai/module/plat/controller/TowerController.java
  35. 152 10
      ai-server/src/main/java/com/zsjz/ai/module/plat/service/SystemService.java
  36. 81 8
      ai-server/src/main/java/com/zsjz/ai/module/plat/service/TowerService.java
  37. 152 0
      electron-migration-plan.md

+ 113 - 0
.workbuddy/memory/2026-09-16.md

@@ -293,6 +293,119 @@ attachment; filename="=?UTF-8?Q?=E9=80=9A=E8=AF=9D=E8=AE=B0=E5=BD=95.xlsx?="; fi
 - 应用里其它 Electron 残留(离线地图 `ElectronPmtilesSource`、窗口控制按钮、授权/升级/基站路径选择器、`useElectronWindow`)
   **与下载无关**,移除需要 Web 替代方案(`<input type=file>`、浏览器目录选择受限等),未擅自改动。
 
+---
+
+## Electron 残留 → 纯 Web 迁移方案(2026-09-16 晚,用户要求列方案)
+
+产出:`electron-migration-plan.md`(仓库根)。全仓 `electron|ipcRenderer|isElectron` 命中点逐个读源码确认用途,
+**共 14 项**:3 项直接删、6 项前端改造即可、5 项需后端配合;4 项 Web 天然做不到(给了降级方案)。
+
+### 清单要点(细节见文档)
+1. 窗口最小化/最大化/关闭(`useElectronWindow` + 4 个组件)→ 直接删,可选保留全屏按钮
+2. 版本号(AppLogo/ProductInfoModal `getVersion()`)→ 构建期常量 `import.meta.env`
+3. **离线地图瓦片**(`ElectronPmtilesSource`,3 个地图组件)→ 换成满足 PMTiles `Source` 接口的
+   `HttpPmtilesSource`(后端 Range 接口,Spring `ResourceHttpRequestHandler` 原生支持 206)或
+   `FilePmtilesSource`(`<input type=file>` + `File.slice().arrayBuffer()`,**零后端改动**)
+4. 离线地图目录选择(ipc `selectFolder`)→ 路径最终存在**服务端**(`/sys/mapLocal`),改为「服务端目录浏览弹窗」或「文本框+校验」
+5. 基站包 `.bin` 选择 → 同上;**不要改成上传**(现有基站包 391MB)
+6. 案件全局配置(ipc `read/writeCaseGlobalConfig`)→ 复用已有的 `/sys/getMaplocal`、`/sys/cellLocal`,或退化为 localStorage
+7. 授权文件(ipc `selectFile` → `/sys/noNet` 收**服务端路径**)→ `<input type=file>` 读文本 + 后端改为收内容(license 仅 316B)
+8. 升级包(ipc `selectFile` → `/sys/upgrade?path=`)→ 建议沿用服务端路径 + 目录浏览,而非上传大 zip
+9. **图谱历史文件读写**(ipc `readTextFile`/`writeTextFile`,路径来自 `graph_his`,本质是服务端文件)
+   → 挪到后端:新增读/存内容两个接口
+10. 基站 xls 选择 + 打开目录 → 选文件复用已有的 `/dm/preFileUpload`(multipart);"打开本地目录" web 做不到,改页内列表
+11. **头像**(`getPathForFile` 存本机路径 + `PersonAvatar` ipc 读图)→ 改为上传(`LocalFileStorageUtil` + `file-url.base-url`),
+    ★ 唯一涉及**存量数据**的项:库里历史 `file:///C:/...` 路径浏览器读不到,需迁移或降级占位图
+12. `governApi.getPackagedFallbackOrigin()`(`file:` 协议兜底 baseURL)→ 直接删
+13. `types/global.d.ts` 的 `window.electron` 声明 → 全部迁完后删
+14. `preFile` 的"Electron 本地路径"注释 → 代码实际只被 importList 用服务端路径调用,仅更新注释
+
+### 实施批次
+P0(1/2/6/12/14,纯删改)→ P1(3-B/7/9/10,前端为主)→ P2(3-A/4/5/8,统一做"服务端目录浏览+校验")→ P3(11,存量数据)→ 收尾(13 + grep 归零)。
+验收:`grep -ri "electron\|ipcRenderer\|isElectron" ai-frontend/src` 归零。
+
+---
+
+## ★★ Electron 迁移批次 2:授权/升级/图谱历史/基站转换/窗口控制/版本号(2026-09-16 晚,全部完成)
+
+用户说「继续做」后,一轮完成了迁移方案里的 **7、8、9、10、1、2、12** 共 7 项(12 顺带)。
+
+### 后端(3 文件)
+| 文件 | 改动 |
+| --- | --- |
+| `SystemController` | `/noNet` 改 `POST`(multipart,`@RequestPart("file") MultipartFile`);删 `GET /upgrade`(按路径),新增 `POST /sys/uploadUpgrade`(multipart);新增 `GET /sys/map/pmtiles`(HTTP Range)与 `GET /sys/map/style` |
+| `SystemService` | `noNet(MultipartFile)`:用 `getOriginalFilename()` 校验 `.xlts` 后缀,`Files.copy` 落盘到 `LICENSE_PATH_FILE`(启动时 `Files.createDirectories(LICENSE_PATH)`);`uploadUpgrade(MultipartFile)`:zip 落盘到 `ROOT_PATH/upgrade-package.zip` → 复用 `upgrade(path)` → finally 清理临时包;`mapPmtiles(rangeHeader)` / `mapStyle()` / 私有 `resolveMapFile` / `serveLocalFile`(`HttpRange.parseRanges` + `ResourceRegion`,多区间/非法/越界 → 416) |
+| `GraphController`/`GraphService` | 新增 `GET /graph/history/{id}/content` 与 `POST /graph/history/{id}/content`(按历史ID读写快照 JSON;`resolveGraphHisFile` 校验路径必须在 `GRAPH_HIS_PATH` 内且为 .json,防任意文件读写) |
+
+**注意**:`SystemService` 没有 `@Slf4j` 的 log —— 那是我加 log.error 编译失败后发现的(GraphService 也没有);这两个类里新代码要么别用 log,要么加注解。`ResourceRegion` 在 `org.springframework.core.io.support` 下。
+
+### 前端(10 文件)
+| 项 | 改动 |
+| --- | --- |
+| 7 授权 | `authorization/index.vue`:ipc 选择器 → 隐藏 `<input type=file accept=".xlts">` + `licenseFile`/`licenseFileName`;`login.ts` 的 `offlineAuthorizationApi(file)` 改 `defHttp.uploadFile`(`ctxPath + adminPath + '/sys/noNet'`)并手动解包 Result(uploadFile 直接走 axiosInstance.request,**不经过 transformRequestHook**) |
+| 8 升级包 | `UpgradeModal.vue`:`<input type=file accept=".zip">` + 上传进度;`setting/api.ts` 新增 `uploadUpgradePackage(file, onProgress)`(uploadFile + 30min 超时),删 `upgradeSystem(path)` |
+| 9 图谱历史 | `graph/index.vue`:写 → `saveGraphHistoryContent(String(historyId), payload)`(historyId 来自 `createGraphHistory` 返回的 `id`);读 → `fetchGraphHistoryContent(remoteId)`;删 ipc 的 `getElectronIpcRenderer`/`writeGraphHistoryPayloadToFile`/`readGraphHistoryPayloadFromFile`(保留 `extractGraphHistoryFilePath` 用于 normalizeGraphHistoryItem 的元数据、`looksLike/normalizeGraphHistoryFilePath` 用于 payload 判别) |
+| 10 基站 | `baseStationQueryApi.ts`:删路径版 `convertBaseStationData`/`fetchBaseStationTemplatePath`,新增 `uploadBaseStationConvert(file, onProgress)`(blob + 原生响应)与 `downloadBaseStationTemplate()`;`aiBaseStation/index.vue`:隐藏 `<input type=file>` + `handleConvertFileChange`(上传→blob→`downloadByData` 下载,JSON 错误体解析)+ `handleFetchTemplate` 改下载模板;删 `openDirectoryByPath`/`resolveTemplatePath`/`doConvertFile` |
+| 1/2 窗口与版本 | 删 `WindowControls/Minimize/Maximize/Close.vue` + `useElectronWindow.ts` + `header/components/index.ts` 导出 + 三个页头的挂载(header/index.vue、authorization、case.vue);AppLogo/ProductInfoModal 版本号改 `__APP_INFO__.pkg.version`(vite define 已注入 `appPkg.version`) |
+| 12 file: 兜底 | `governApi.ts` 删 `DEFAULT_ELECTRON_API_URL` + `getPackagedFallbackOrigin()`,host 兜底链只剩同源 |
+
+### ★ 踩坑记录(这批最费时间的三处)
+1. **CRLF 匹配**:这批 .vue 是 CRLF,多行 old 字符串用 `\n` 全部失配 → 脚本必须先探测 EOL(`\r\n` vs `\n` 计数),统一转 LF 处理再按原 EOL 写回。
+2. **prettier --fix 后的连锁**:eslint --fix 会把 script 里手工插入的行重排(如把 `(cond ? a : '')` 的括号去掉、把 import 折行),别把 --fix 前的预期当真,以 --fix 后的 grep 为准。
+3. **误删恢复**:对 `aiBaseStation/index.vue` 的行过滤把 `getCarrierLabel` 连带删了 → 发现后立即恢复(用唯一锚点行重插)。
+
+### 验证
+- 后端 `mvn -pl ai-server -B compile` → BUILD SUCCESS
+- 前端 eslint(10 个改动文件)0 错误;`vue-tsc` 全仓 103(无新增)
+- `HttpPmtilesSource` 10 项运行时断言全通过(本地 Range 服务)
+- 迁移方案文档总览表已逐项标 ✅
+
+
+---
+
+## 实施(2026-09-16 晚):地图瓦片走方案A + 删除两个路径选择功能
+
+用户决定:`离线地图目录选择` 删除、`基站库(.bin)选择` 删除、`离线地图瓦片用方案A`。
+
+### 后端(SystemController + SystemService)
+- 新增 `GET /sys/map/pmtiles`:从系统配置 `mapLocal` 目录读 `china.pmtiles`,**支持 HTTP Range**
+  (无 Range → 200 全量 + `Accept-Ranges: bytes`;单区间 → 206 `ResourceRegion`;多区间/非法/越界 → 416)
+- 新增 `GET /sys/map/style`:返回配置目录里的 `behavior-spacetime-style.json`(无则 404,前端回退内置样式)
+- 逻辑全在 service:`mapPmtiles` / `mapStyle` / `resolveMapFile` / `serveLocalFile` / `rangeNotSatisfiable`;controller 仅转发
+- ★ 两个接口**刻意不返回 Result**(响应体是文件内容),文件名是服务端常量白名单,不接受调用方传参 —— 已加入「刻意裸返回」清单
+- ★ 坑:`ResourceRegion` 的包是 **`org.springframework.core.io.support.ResourceRegion`**(不是 `core.io`)
+
+### 前端
+- `core/utils/map/offlineMap.ts`:删 `ElectronPmtilesSource`,新增 `HttpPmtilesSource`(fetch + Range 头)、
+  `getOfflineMapPmtilesUrl()` / `getOfflineMapStyleUrl()` / `getBuiltinPmtilesUrl()` / `resolveOfflinePmtilesUrls()`;
+  删掉三个已无用的本地路径 URL 工具(`getOfflineMapPmtilesUrl` 旧的本地版 / `getOfflineMapFileUrl` / `getOfflineMapFilePath`)
+- 三个地图组件(`BaseStationQueryMap.vue`/`StationMapModal.vue`/`behaviorSpacetime/index.vue`):
+  瓦片源换 `HttpPmtilesSource`(服务端目录未配置则回退前端静态 `resource/map/china.pmtiles`,并把它也注册成源);
+  自定义样式读取从 ipc `readTextFile` 换成 `fetch /sys/map/style`
+- **删除**:`OfflineMapModal.vue`、`CellLocalModal.vue`、`core/utils/caseGlobalConfig.ts`(ipc 持久化)、
+  `SettingFooter.vue` 两个入口按钮/弹窗/引导监听、`components/index.ts` 两个导出、`caseConfigGuide.ts` 的 hydrate 调用与两个弹窗事件常量
+
+### ★ 删掉 UI 后路径怎么配(重要,写进文档了)
+两条路径本来就存在**服务端**(`SystemConfManager` → `QingJian/conf/c5e503ad.json` 的 `mapLocal`/`cellLocal`):
+1. 接口:`GET /js/a/sys/mapLocal?path=...`、`GET /js/a/sys/cellLocal?path=...`
+2. 直接编辑 `QingJian/conf/c5e503ad.json`(**改完要重启后端**,配置是启动时读入内存的)
+
+### 验证(都做了实测,不只是编译)
+- 后端 `mvn -pl ai-server -B compile` → BUILD SUCCESS
+- **Range 分支**:用真实 spring-web 6.2.19 复刻 `serveLocalFile` 逻辑跑 9 例(`0-99`/`100-`/`-100`/`999-999` → 206;
+  `0-1,5-6`/`abc`/`2000-3000`/`-0` → 416;无 Range → 200)**全通过**
+  (注:`bytes=2000-3000` 的 416 是靠 `ResourceRegion` 的 count<0 断言抛错兜住的,`HttpRange` 本身不报错)
+- **前端**:esbuild 打包真实 `offlineMap.ts` + 起本地 Range 服务,10 项断言(URL 拼装 / Range 头 / 返回字节 / 空参数不发请求 / 404 返回空)**全通过**
+- `eslint --max-warnings 0` 0 错误;`vue-tsc` 全仓仍 103(无新增)
+
+### 遗留(可选清理)
+`cellLocal.ts` 里 `getCellLocalPath`/`getManualCellLocalPath`/`getServerCellLocalPath`/`setCellLocalPath`/`isValidCellLocalPath`/
+`CELL_LOCAL_PATH_CHANGED_EVENT` 与 `offlineMap.ts` 里 `getManualOfflineMapDir`/`getServerOfflineMapDir`/`setOfflineMapDir`/`clearOfflineMapDir`
+在删掉两个弹窗后已无引用(纯 localStorage 工具,无 Electron 代码),未删以控制改动面。
+`getOfflineMapDir()` 仍保留读旧的 `OFFLINE_MAP_DIR_KEY` 作为兜底(兼容 Electron 时代留下的 localStorage)。
+
+
+
 
 
 

+ 1 - 7
ai-frontend/src/case/api/govern/governApi.ts

@@ -7,7 +7,6 @@ import { Query } from '@/types';
 import { GovernTreeQuery } from './types/query';
 
 const { ctxPath, adminPath } = useGlobSetting();
-const DEFAULT_ELECTRON_API_URL = 'http://localhost:8980';
 
 const trimRightSlash = (value = '') => value.replace(/\/+$/, '');
 const ensureLeftSlash = (value = '') => (value.startsWith('/') ? value : `/${value}`);
@@ -29,11 +28,6 @@ const getRuntimeOrigin = () => {
   return origin && origin !== 'null' ? origin : '';
 };
 
-const getPackagedFallbackOrigin = () => {
-  if (typeof window === 'undefined') return '';
-  return window.location.protocol === 'file:' ? DEFAULT_ELECTRON_API_URL : '';
-};
-
 export const getAdminBaseUrl = () => {
   const { apiUrl, urlPrefix, adminPath } = useGlobSetting();
   if (adminPath?.startsWith('http')) {
@@ -43,7 +37,7 @@ export const getAdminBaseUrl = () => {
   const prefix = urlPrefix || '';
   const normalizedAdminPath =
     prefix && adminPath?.startsWith(`${prefix}/`) ? adminPath : joinUrl(prefix, adminPath || '/a');
-  const host = trimRightSlash(apiUrl || '') || getRuntimeOrigin() || getPackagedFallbackOrigin();
+  const host = trimRightSlash(apiUrl || '') || getRuntimeOrigin();
   return joinUrl(host, normalizedAdminPath);
 };
 

+ 22 - 20
ai-frontend/src/case/views/dm/components/StationMapModal.vue

@@ -25,9 +25,11 @@
   import { BasicModal } from '@/core/components/Modal';
   import { useDesign } from '@/core/hooks/web/useDesign';
   import {
-    ElectronPmtilesSource,
+    HttpPmtilesSource,
     getOfflineMapDir,
-    getOfflineMapFilePath,
+    getOfflineMapPmtilesUrl,
+    getOfflineMapStyleUrl,
+    resolveOfflinePmtilesUrls,
     OFFLINE_MAP_DIR_CHANGED_EVENT,
     toLocalMapUrl,
   } from '@/core/utils/map/offlineMap';
@@ -148,10 +150,10 @@
     pmtilesRegistered = true;
   };
   const ensureOfflinePmtilesArchive = () => {
-    const filePath = getOfflineMapFilePath('china.pmtiles');
-    if (!pmtilesProtocol || !filePath) return;
-    if (pmtilesProtocol.get(filePath)) return;
-    pmtilesProtocol.add(new PMTiles(new ElectronPmtilesSource(filePath) as any));
+    if (!pmtilesProtocol) return;
+    resolveOfflinePmtilesUrls().forEach((url) => {
+      if (!pmtilesProtocol?.get(url)) pmtilesProtocol?.add(new PMTiles(new HttpPmtilesSource(url) as any));
+    });
   };
 
   const getPublicBaseUrl = () => new URL(import.meta.env.BASE_URL || './', window.location.href).toString();
@@ -196,15 +198,15 @@
 
   const buildExternalMapStyle = () => {
     const offlineMapDir = getOfflineMapDir();
-    const pmtilesFilePath = getOfflineMapFilePath('china.pmtiles');
-    if (!offlineMapDir || !pmtilesFilePath) return null;
+    const pmtilesUrl = getOfflineMapDir() ? getOfflineMapPmtilesUrl() : '';
+    if (!offlineMapDir || !pmtilesUrl) return null;
     return {
       version: 8,
       name: 'portrait-offline-map-external',
       sources: {
         'behavior-basemap': {
           type: 'vector',
-          url: `${PMTILES_PROTOCOL}${pmtilesFilePath}`,
+          url: `${PMTILES_PROTOCOL}${pmtilesUrl}`,
         },
       },
       layers: [
@@ -286,13 +288,13 @@
       ],
     };
   };
-  const getOfflineMapStylePath = () => getOfflineMapFilePath('behavior-spacetime-style.json');
+  /** 读取服务端配置目录里的自定义样式(Web:走后端 /sys/map/style,替代原 Electron ipc 读文件) */
   const readOfflineMapStyle = async () => {
-    const ipcRenderer = (window as any)?.electron?.ipcRenderer;
-    const filePath = getOfflineMapStylePath();
-    if (!ipcRenderer?.invoke || !filePath) return '';
+    if (!getOfflineMapDir()) return '';
     try {
-      return (await ipcRenderer.invoke('controller/os/readTextFile', { filePath, encoding: 'utf8' })) || '';
+      const response = await fetch(getOfflineMapStyleUrl(), { cache: 'no-store' });
+      if (!response.ok) return '';
+      return await response.text();
     } catch {
       return '';
     }
@@ -302,15 +304,15 @@
     const custom = (window as PortraitStationWindow).__BEHAVIOR_SPACETIME_STYLE__ || STYLE_PATH;
     try {
       const offlineMapDir = getOfflineMapDir();
-      const offlinePmtilesFilePath = getOfflineMapFilePath('china.pmtiles');
-      const offlineStylePath = getOfflineMapStylePath();
-      if (offlineMapDir && offlinePmtilesFilePath && offlineStylePath) {
+      const offlinePmtilesUrl = getOfflineMapDir() ? getOfflineMapPmtilesUrl() : '';
+      const offlineStyleUrl = getOfflineMapStyleUrl();
+      if (offlineMapDir && offlinePmtilesUrl && offlineStyleUrl) {
         const styleText = await readOfflineMapStyle();
         if (styleText) {
           const style = JSON.parse(styleText);
           mapMode.value = 'template';
           errorMsg.value = '';
-          return normalizePmtilesSources(style as Record<string, any>, offlineStylePath, offlinePmtilesFilePath);
+          return normalizePmtilesSources(style as Record<string, any>, offlineStyleUrl, offlinePmtilesUrl);
         }
       }
       const externalStyle = buildExternalMapStyle();
@@ -322,7 +324,7 @@
       if (custom && typeof custom === 'object') {
         mapMode.value = 'template';
         errorMsg.value = '';
-        return normalizePmtilesSources(custom, window.location.href, offlinePmtilesFilePath || undefined);
+        return normalizePmtilesSources(custom, window.location.href, offlinePmtilesUrl || undefined);
       }
       const styleUrl = resolveStyleAssetUrl(String(custom), window.location.href);
       const response = await fetch(styleUrl, { cache: 'no-store' });
@@ -333,7 +335,7 @@
       return normalizePmtilesSources(
         style as Record<string, any>,
         response.url || styleUrl,
-        offlinePmtilesFilePath || undefined,
+        offlinePmtilesUrl || undefined,
       );
     } catch (error) {
       errorMsg.value = error instanceof Error ? error.message : 'style error';

+ 18 - 5
ai-frontend/src/core/api/sys/login.ts

@@ -12,7 +12,7 @@ import { encryptByBase64 } from '@/core/utils/cipher';
 import { Menu } from '@/core/router/types';
 import { useAppStore } from '@/core/store/modules/app';
 
-const { adminPath } = useGlobSetting();
+const { adminPath, ctxPath } = useGlobSetting();
 
 export interface LoginParams {
   id: string;
@@ -114,11 +114,24 @@ export const downloadFileApi = (fileId: string | number): Promise<AxiosResponse<
     { errorMessageMode: 'none', skipErrorMessage: true, isReturnNativeResponse: true },
   );
 
-export const offlineAuthorizationApi = (license: string) =>
-  defHttp.get<Result>(
-    { url: adminPath + '/sys/noNet', params: { license }, timeout: 10 * 1000 },
-    { errorMessageMode: 'none', isTransformResponse: false },
+/**
+ * 无外网授权激活(离线授权)。
+ *
+ * <p>Web 化改造:前端直接上传 {@code .xlts} 授权文件,后端落盘并校验,
+ * 不再传服务端文件路径。上传接口不走 defHttp 的 transform,这里手动解包 Result。
+ */
+export const offlineAuthorizationApi = async (file: File): Promise<Result> => {
+  const response = await defHttp.uploadFile<Result>(
+    { url: ctxPath + adminPath + '/sys/noNet', timeout: 3 * 60 * 1000 },
+    { name: 'file', file, filename: file.name },
   );
+  // uploadFile 直接走 axiosInstance.request,返回原始 AxiosResponse,data 才是 Result
+  const body = (response as any)?.data as Result | undefined;
+  if (body && Number(body.code ?? 200) !== 200) {
+    throw new Error(body.message || '离线授权失败');
+  }
+  return (body || { code: 200 }) as Result;
+};
 
 export const checkAuthApi = () =>
   defHttp.get<Result>(

+ 3 - 8
ai-frontend/src/core/components/Application/src/AppLogo.vue

@@ -15,14 +15,13 @@
   </div>
 </template>
 <script lang="ts" setup>
-  import { computed, unref, ref, onMounted } from 'vue';
+  import { computed, unref } from 'vue';
   import { useGlobSetting } from '@/core/hooks/setting';
   import { useGo } from '@/core/hooks/web/usePage';
   import { useMenuSetting } from '@/core/hooks/setting/useMenuSetting';
   import { useDesign } from '@/core/hooks/web/useDesign';
   import { PageEnum } from '@/core/enums/pageEnum';
   import { useUserStore } from '@/core/store/modules/case';
-  import { useElectronWindow } from '@/core/hooks/electron/useElectronWindow';
 
   import { isTrialAuthorizationLabel } from '@/core/utils/license';
 
@@ -45,13 +44,9 @@
   const { getCollapsedShowTitle } = useMenuSetting();
   const userStore = useUserStore();
   const go = useGo();
-  const { getVersion } = useElectronWindow();
 
-  const appVersion = ref('');
-
-  onMounted(() => {
-    appVersion.value = getVersion();
-  });
+  // 版本号来自构建期注入的 package.json 信息(Web 化后不再依赖 Electron 的 getVersion)
+  const appVersion = String(__APP_INFO__?.pkg?.version || '');
 
   const getTitle = computed(() => {
     const { title } = useGlobSetting();

+ 0 - 44
ai-frontend/src/core/hooks/electron/useElectronWindow.ts

@@ -1,44 +0,0 @@
-import { ref } from 'vue';
-
-const isMaximized = ref(false);
-
-let _api: any = null;
-function api() {
-  if (!_api) _api = (window as any).electron;
-  return _api;
-}
-
-function checkMaximized() {
-  const a = api();
-  if (a) isMaximized.value = a.windowIsMaximized();
-}
-
-let _init = false;
-function ensureInit() {
-  if (_init) return;
-  _init = true;
-  const a = api();
-  if (!a) return;
-  checkMaximized();
-  window.addEventListener('resize', checkMaximized);
-  a.ipcRenderer?.on('window:maximize-change', (_e: any, v: boolean) => {
-    isMaximized.value = v;
-  });
-}
-
-export function useElectronWindow() {
-  ensureInit();
-  return {
-    isElectron: !!api(),
-    isMaximized,
-    getVersion: () => api()?.getVersion() || '',
-    winMinimize: () => api()?.windowMinimize(),
-    winMaximize: () => {
-      const a = api();
-      if (!a) return;
-      if (isMaximized.value) a.windowUnmaximize();
-      else a.windowMaximize();
-    },
-    winClose: () => api()?.windowClose(),
-  };
-}

+ 0 - 21
ai-frontend/src/core/layouts/default/header/components/WindowClose.vue

@@ -1,21 +0,0 @@
-<template>
-  <span v-if="isElectron" class="jeesite-header-action-button" @click="winClose">
-    <CloseOutlined />
-  </span>
-</template>
-<script lang="ts">
-  import { defineComponent } from 'vue';
-  import { Tooltip } from 'ant-design-vue';
-  import { CloseOutlined } from '@ant-design/icons-vue';
-  import { useElectronWindow } from '@/core/hooks/electron/useElectronWindow';
-
-  export default defineComponent({
-    name: 'WindowClose',
-    components: { CloseOutlined, Tooltip },
-    setup() {
-      const { isElectron, winClose } = useElectronWindow();
-      return { isElectron, winClose };
-    },
-  });
-</script>
-<style scoped></style>

+ 0 - 23
ai-frontend/src/core/layouts/default/header/components/WindowControls.vue

@@ -1,23 +0,0 @@
-<template>
-  <template v-if="isElectron">
-    <WindowMinimizeBtn />
-    <WindowMaximizeBtn />
-    <WindowCloseBtn />
-  </template>
-</template>
-<script lang="ts">
-  import { defineComponent } from 'vue';
-  import { useElectronWindow } from '@/core/hooks/electron/useElectronWindow';
-  import WindowMinimizeBtn from './WindowMinimize.vue';
-  import WindowMaximizeBtn from './WindowMaximize.vue';
-  import WindowCloseBtn from './WindowClose.vue';
-
-  export default defineComponent({
-    name: 'WindowControls',
-    components: { WindowMinimizeBtn, WindowMaximizeBtn, WindowCloseBtn },
-    setup() {
-      const { isElectron } = useElectronWindow();
-      return { isElectron };
-    },
-  });
-</script>

+ 0 - 21
ai-frontend/src/core/layouts/default/header/components/WindowMaximize.vue

@@ -1,21 +0,0 @@
-<template>
-  <span v-if="isElectron" class="jeesite-header-action-button" @click="winMaximize">
-    <BorderOutlined v-if="!isMaximized" />
-    <SwitcherOutlined v-else />
-  </span>
-</template>
-<script lang="ts">
-  import { defineComponent } from 'vue';
-  import { Tooltip } from 'ant-design-vue';
-  import { BorderOutlined, SwitcherOutlined } from '@ant-design/icons-vue';
-  import { useElectronWindow } from '@/core/hooks/electron/useElectronWindow';
-
-  export default defineComponent({
-    name: 'WindowMaximize',
-    components: { BorderOutlined, SwitcherOutlined, Tooltip },
-    setup() {
-      const { isElectron, isMaximized, winMaximize } = useElectronWindow();
-      return { isElectron, isMaximized, winMaximize };
-    },
-  });
-</script>

+ 0 - 20
ai-frontend/src/core/layouts/default/header/components/WindowMinimize.vue

@@ -1,20 +0,0 @@
-<template>
-  <span v-if="isElectron" class="jeesite-header-action-button" @click="winMinimize">
-    <MinusOutlined />
-  </span>
-</template>
-<script lang="ts">
-  import { defineComponent } from 'vue';
-  import { Tooltip } from 'ant-design-vue';
-  import { MinusOutlined } from '@ant-design/icons-vue';
-  import { useElectronWindow } from '@/core/hooks/electron/useElectronWindow';
-
-  export default defineComponent({
-    name: 'WindowMinimize',
-    components: { MinusOutlined, Tooltip },
-    setup() {
-      const { isElectron, winMinimize } = useElectronWindow();
-      return { isElectron, winMinimize };
-    },
-  });
-</script>

+ 0 - 7
ai-frontend/src/core/layouts/default/header/components/index.ts

@@ -1,9 +1,6 @@
 import { createAsyncComponent } from '@/core/utils/factory/createAsyncComponent';
 import FullScreen from './FullScreen.vue';
 import LogoutButton from './LogoutButton.vue';
-import WindowMinimize from './WindowMinimize.vue';
-import WindowMaximize from './WindowMaximize.vue';
-import WindowClose from './WindowClose.vue';
 
 export const LayoutBreadcrumb = createAsyncComponent(() => import('./Breadcrumb.vue'));
 
@@ -20,7 +17,3 @@ export const SettingDrawer = createAsyncComponent(() => import('@/core/layouts/d
 export { FullScreen };
 
 export { LogoutButton };
-
-export { default as WindowControls } from './WindowControls.vue';
-
-export { WindowMinimize, WindowMaximize, WindowClose };

+ 1 - 16
ai-frontend/src/core/layouts/default/header/index.vue

@@ -53,9 +53,6 @@
 
       <LogoutButton class="logout-item" />
       <span :class="`${prefixCls}-search-divider`"></span>
-      <WindowMinimize />
-      <WindowMaximize />
-      <WindowClose />
     </div>
   </ALayoutHeader>
 </template>
@@ -85,16 +82,7 @@
   import { CASE_INFO_KEY } from '@/core/enums/cacheEnum';
   import LayoutMenu from '../menu/index.vue';
   import LayoutTrigger from '../trigger/index.vue';
-  import {
-    LayoutBreadcrumb,
-    FullScreen,
-    ErrorAction,
-    SettingDrawer,
-    LogoutButton,
-    WindowMinimize,
-    WindowMaximize,
-    WindowClose,
-  } from './components';
+  import { LayoutBreadcrumb, FullScreen, ErrorAction, SettingDrawer, LogoutButton } from './components';
 
   const HEADER_TEMPLATE_LIBRARY_OPEN_EVENT = 'layout-header:open-template-library';
 
@@ -114,9 +102,6 @@
       LogoutButton,
       Tooltip,
       Icon,
-      WindowMinimize,
-      WindowMaximize,
-      WindowClose,
     },
     props: {
       fixed: propTypes.bool,

+ 17 - 11
ai-frontend/src/core/layouts/default/setting/api.ts

@@ -1,16 +1,22 @@
-import { useGlobSetting } from "@/core/hooks/setting";
-import { defHttp } from "@/core/utils/http/axios";
-const { adminPath } = useGlobSetting();
+import { useGlobSetting } from '@/core/hooks/setting';
+import { defHttp } from '@/core/utils/http/axios';
+const { adminPath, ctxPath } = useGlobSetting();
 
-export const cleanCache = () =>
-  defHttp.get<void>({ url: adminPath + '/sys/cleanCache' });
+export const cleanCache = () => defHttp.get<void>({ url: adminPath + '/sys/cleanCache' });
 
-export const upgradeSystem = (path: string) =>
-  defHttp.get<void>(
+/**
+ * 上传升级包并执行升级(Web 化:前端上传 zip,不再传服务端路径)。
+ * 升级耗时较长(解压 + 覆盖数据库 + 执行升级 SQL),超时给了 30 分钟。
+ */
+export const uploadUpgradePackage = (file: File, onProgress?: (percent: number) => void) =>
+  defHttp.uploadFile<void>(
     {
-      url: adminPath + '/sys/upgrade',
-      params: { path },
-      timeout: 10 * 60 * 1000,
+      url: ctxPath + adminPath + '/sys/uploadUpgrade',
+      timeout: 30 * 60 * 1000,
+      onUploadProgress: (progressEvent: any) => {
+        if (!onProgress || !progressEvent.total) return;
+        onProgress(Math.round((progressEvent.loaded * 100) / progressEvent.total));
+      },
     },
-    { errorMessageMode: 'message' },
+    { name: 'file', file, filename: file.name },
   );

+ 0 - 209
ai-frontend/src/core/layouts/default/setting/components/CellLocalModal.vue

@@ -1,209 +0,0 @@
-<template>
-  <BasicModal
-    v-bind="$attrs"
-    title="基站包路径"
-    :width="620"
-    :centered="true"
-    @register="registerModal"
-    @ok="handleSubmit"
-  >
-    <div :class="prefixCls">
-      <div class="cell-local-modal__tip">请选择基站包文件,仅支持 `.bin` 结尾的文件。</div>
-      <!-- <div v-if="effectivePath" class="cell-local-modal__meta">
-        当前生效路径:{{ effectivePath }}
-        <span v-if="serverPath">(系统返回优先)</span>
-        <span v-else-if="manualPath">(本地手动设置)</span>
-      </div> -->
-
-      <div class="cell-local-modal__path-box" @click="handleSelectFile">
-        <div class="cell-local-modal__path-value">
-          {{ filePath || '点击选择基站包文件' }}
-        </div>
-      </div>
-
-      <div class="cell-local-modal__actions">
-        <a-button size="small" @click.stop="handleClear">清空路径</a-button>
-      </div>
-    </div>
-  </BasicModal>
-</template>
-
-<script lang="ts" setup>
-  import { computed, ref, watch } from 'vue';
-  import { setCellLocalApi } from '@/core/api/sys/cellLocal';
-  import { BasicModal, useModalInner } from '@/core/components/Modal';
-  import { useDesign } from '@/core/hooks/web/useDesign';
-  import { useMessage } from '@/core/hooks/web/useMessage';
-  import { writePersistedCaseGlobalConfig } from '@/core/utils/caseGlobalConfig';
-  import {
-    clearCellLocalPath,
-    getCellLocalPath,
-    getManualCellLocalPath,
-    getServerCellLocalPath,
-    isValidCellLocalPath,
-    setCellLocalPath,
-    setServerCellLocalPath,
-  } from '@/core/utils/cell/cellLocal';
-
-  const { prefixCls } = useDesign('cell-local-modal');
-  const { createMessage } = useMessage();
-  const filePath = ref('');
-  const submitting = ref(false);
-  const effectivePath = computed(() => getCellLocalPath());
-  const serverPath = computed(() => getServerCellLocalPath());
-  const manualPath = computed(() => getManualCellLocalPath());
-
-  watch(
-    effectivePath,
-    (path) => {
-      if (path && !filePath.value) {
-        filePath.value = path;
-      }
-    },
-    { immediate: true },
-  );
-
-  const [registerModal, { closeModal, setModalProps }] = useModalInner(() => {
-    filePath.value = getCellLocalPath();
-    submitting.value = false;
-    setModalProps({ confirmLoading: false });
-  });
-
-  async function handleSelectFile() {
-    const ipcRenderer = (window as any)?.electron?.ipcRenderer;
-    if (!ipcRenderer?.invoke) {
-      createMessage.error('无法选择文件,请在 Electron 环境下操作');
-      return;
-    }
-    try {
-      const resolvedPath = await ipcRenderer.invoke('controller/os/selectBinFile');
-      if (!resolvedPath || typeof resolvedPath !== 'string') return;
-      const selectedPath = resolvedPath.trim();
-      if (!isValidCellLocalPath(selectedPath)) {
-        createMessage.error('请选择 .bin 结尾的基站包文件');
-        return;
-      }
-      filePath.value = selectedPath;
-    } catch (error: any) {
-      createMessage.error(error?.message || '选择基站包文件失败');
-    }
-  }
-
-  function handleClear() {
-    filePath.value = '';
-  }
-
-  async function handleSubmit() {
-    if (submitting.value) return;
-    submitting.value = true;
-    const nextPath = filePath.value.trim();
-    if (nextPath && !isValidCellLocalPath(nextPath)) {
-      createMessage.error('请选择 .bin 结尾的基站包文件');
-      submitting.value = false;
-      return;
-    }
-    const ipcRenderer = (window as any)?.electron?.ipcRenderer;
-    if (nextPath && ipcRenderer?.invoke) {
-      try {
-        const fileContent = await ipcRenderer.invoke('controller/os/readBinaryFileRange', {
-          filePath: nextPath,
-          offset: 0,
-          length: 16,
-        });
-        if (!fileContent?.data && !fileContent?.size) {
-          createMessage.error('所选基站包文件不可读取');
-          submitting.value = false;
-          return;
-        }
-      } catch {
-        createMessage.error('所选基站包文件不可读取');
-        submitting.value = false;
-        return;
-      }
-    }
-    setModalProps({ confirmLoading: true });
-    try {
-      const res = await setCellLocalApi(nextPath);
-      const code = Number((res as any)?.code ?? 200);
-      if (code !== 200) {
-        createMessage.error((res as any)?.msg || (res as any)?.message || '基站包路径保存失败');
-        submitting.value = false;
-        return;
-      }
-    } catch (error: any) {
-      createMessage.error(error?.message || '基站包路径保存失败');
-      submitting.value = false;
-      return;
-    } finally {
-      setModalProps({ confirmLoading: false });
-      submitting.value = false;
-    }
-    if (nextPath) {
-      setCellLocalPath(nextPath);
-      setServerCellLocalPath(nextPath);
-      void writePersistedCaseGlobalConfig({ cellLocalPath: nextPath });
-      createMessage.success('基站包路径已保存');
-    } else {
-      clearCellLocalPath();
-      setServerCellLocalPath('');
-      void writePersistedCaseGlobalConfig({ cellLocalPath: '' });
-      createMessage.success('已清空基站包路径');
-    }
-    closeModal();
-  }
-</script>
-
-<style lang="less">
-  @prefix-cls: ~'jeesite-cell-local-modal';
-
-  .@{prefix-cls} {
-    .cell-local-modal__tip {
-      margin-bottom: 14px;
-      font-size: 13px;
-      line-height: 1.6;
-      color: #6b7280;
-    }
-
-    .cell-local-modal__meta {
-      margin-bottom: 12px;
-      font-size: 12px;
-      line-height: 1.6;
-      color: #475569;
-      word-break: break-all;
-    }
-
-    .cell-local-modal__path-box {
-      padding: 14px;
-      cursor: pointer;
-      background: #f8fafc;
-      border: 1px solid #e5e7eb;
-      border-radius: 10px;
-      transition:
-        border-color 0.2s ease,
-        background-color 0.2s ease;
-
-      &:hover {
-        background: #f1f5f9;
-        border-color: #93c5fd;
-      }
-    }
-
-    .cell-local-modal__path-value {
-      min-height: 44px;
-      padding: 10px 12px;
-      font-size: 12px;
-      line-height: 1.6;
-      color: #4b5563;
-      word-break: break-all;
-      background: #fff;
-      border: 1px dashed #cbd5e1;
-      border-radius: 8px;
-    }
-
-    .cell-local-modal__actions {
-      display: flex;
-      justify-content: flex-end;
-      margin-top: 12px;
-    }
-  }
-</style>

+ 0 - 189
ai-frontend/src/core/layouts/default/setting/components/OfflineMapModal.vue

@@ -1,189 +0,0 @@
-<template>
-  <BasicModal
-    v-bind="$attrs"
-    title="离线地图位置"
-    :width="620"
-    :centered="true"
-    @register="registerModal"
-    @ok="handleSubmit"
-  >
-    <div :class="prefixCls">
-      <div class="offline-map-modal__tip">请选择离线地图目录,目录内需包含 `china.pmtiles` 文件。</div>
-      <!-- <div v-if="effectivePath" class="offline-map-modal__meta">
-        当前生效路径:{{ effectivePath }}
-        <span v-if="serverPath">(系统返回优先)</span>
-        <span v-else-if="manualPath">(本地手动设置)</span>
-      </div> -->
-
-      <div class="offline-map-modal__path-box" @click="handleSelectFolder">
-        <div class="offline-map-modal__path-value">
-          {{ folderPath || '点击选择离线地图目录' }}
-        </div>
-      </div>
-
-      <div class="offline-map-modal__actions">
-        <a-button size="small" @click.stop="handleClear">清空路径</a-button>
-      </div>
-    </div>
-  </BasicModal>
-</template>
-
-<script lang="ts" setup>
-  import { computed, ref, watch } from 'vue';
-  import { setMapLocalApi } from '@/core/api/sys/mapLocal';
-  import { BasicModal, useModalInner } from '@/core/components/Modal';
-  import { useDesign } from '@/core/hooks/web/useDesign';
-  import { useMessage } from '@/core/hooks/web/useMessage';
-  import { writePersistedCaseGlobalConfig } from '@/core/utils/caseGlobalConfig';
-  import {
-    clearOfflineMapDir,
-    getManualOfflineMapDir,
-    getOfflineMapDir,
-    getServerOfflineMapDir,
-    setOfflineMapDir,
-    setServerOfflineMapDir,
-  } from '@/core/utils/map/offlineMap';
-
-  const { prefixCls } = useDesign('offline-map-modal');
-  const { createMessage } = useMessage();
-  const folderPath = ref('');
-  const effectivePath = computed(() => getOfflineMapDir());
-  const serverPath = computed(() => getServerOfflineMapDir());
-  const manualPath = computed(() => getManualOfflineMapDir());
-
-  watch(
-    effectivePath,
-    (path) => {
-      if (path && !folderPath.value) {
-        folderPath.value = path;
-      }
-    },
-    { immediate: true },
-  );
-
-  const [registerModal, { closeModal, setModalProps }] = useModalInner(() => {
-    folderPath.value = getOfflineMapDir();
-    setModalProps({ confirmLoading: false });
-  });
-
-  async function handleSelectFolder() {
-    const ipcRenderer = (window as any)?.electron?.ipcRenderer;
-    if (!ipcRenderer?.invoke) {
-      createMessage.error('无法选择目录,请在 Electron 环境下操作');
-      return;
-    }
-    try {
-      const resolvedPath = await ipcRenderer.invoke('controller/os/selectFolder');
-      if (!resolvedPath || typeof resolvedPath !== 'string') return;
-      folderPath.value = resolvedPath.trim();
-    } catch (error: any) {
-      createMessage.error(error?.message || '选择离线地图目录失败');
-    }
-  }
-
-  function handleClear() {
-    folderPath.value = '';
-  }
-
-  async function handleSubmit() {
-    const nextPath = folderPath.value.trim();
-    const ipcRenderer = (window as any)?.electron?.ipcRenderer;
-    if (nextPath && ipcRenderer?.invoke) {
-      try {
-        const fileContent = await ipcRenderer.invoke('controller/os/readBinaryFileRange', {
-          filePath: `${nextPath.replace(/[\\/]+$/, '')}\\china.pmtiles`,
-          offset: 0,
-          length: 16,
-        });
-        if (!fileContent?.data && !fileContent?.size) {
-          createMessage.error('所选目录内未找到 china.pmtiles 文件');
-          return;
-        }
-      } catch {
-        createMessage.error('所选目录内未找到 china.pmtiles 文件');
-        return;
-      }
-    }
-    setModalProps({ confirmLoading: true });
-    try {
-      const res = await setMapLocalApi(nextPath);
-      const code = Number((res as any)?.code ?? 200);
-      if (code !== 200) {
-        createMessage.error((res as any)?.msg || (res as any)?.message || '离线地图目录保存失败');
-        return;
-      }
-    } catch (error: any) {
-      createMessage.error(error?.message || '离线地图目录保存失败');
-      return;
-    } finally {
-      setModalProps({ confirmLoading: false });
-    }
-    if (nextPath) {
-      setOfflineMapDir(nextPath);
-      setServerOfflineMapDir(nextPath);
-      void writePersistedCaseGlobalConfig({ offlineMapDir: nextPath });
-      createMessage.success('离线地图目录已保存');
-    } else {
-      clearOfflineMapDir();
-      setServerOfflineMapDir('');
-      void writePersistedCaseGlobalConfig({ offlineMapDir: '' });
-      createMessage.success('已清空离线地图目录');
-    }
-    closeModal();
-  }
-</script>
-
-<style lang="less">
-  @prefix-cls: ~'jeesite-offline-map-modal';
-
-  .@{prefix-cls} {
-    .offline-map-modal__tip {
-      margin-bottom: 14px;
-      font-size: 13px;
-      line-height: 1.6;
-      color: #6b7280;
-    }
-
-    .offline-map-modal__meta {
-      margin-bottom: 12px;
-      font-size: 12px;
-      line-height: 1.6;
-      color: #475569;
-      word-break: break-all;
-    }
-
-    .offline-map-modal__path-box {
-      padding: 14px;
-      cursor: pointer;
-      background: #f8fafc;
-      border: 1px solid #e5e7eb;
-      border-radius: 10px;
-      transition:
-        border-color 0.2s ease,
-        background-color 0.2s ease;
-
-      &:hover {
-        background: #f1f5f9;
-        border-color: #93c5fd;
-      }
-    }
-
-    .offline-map-modal__path-value {
-      min-height: 44px;
-      padding: 10px 12px;
-      font-size: 12px;
-      line-height: 1.6;
-      color: #4b5563;
-      word-break: break-all;
-      background: #fff;
-      border: 1px dashed #cbd5e1;
-      border-radius: 8px;
-    }
-
-    .offline-map-modal__actions {
-      display: flex;
-      justify-content: flex-end;
-      margin-top: 12px;
-    }
-  }
-</style>

+ 3 - 8
ai-frontend/src/core/layouts/default/setting/components/ProductInfoModal.vue

@@ -14,7 +14,7 @@
         <div class="product-info__version" v-if="appVersion">v{{ appVersion }}</div>
       </div>
 
-      <div class="product-info__divider" />
+      <div class="product-info__divider"></div>
 
       <div class="product-info__meta">
         <div class="product-info__meta-item">
@@ -26,7 +26,7 @@
           <span class="product-info__meta-value">18908093240</span>
         </div>
       </div>
-      <div class="product-info__divider" />
+      <div class="product-info__divider"></div>
       <div class="product-info__desc">
         面向案件研判与专题分析场景,提供图谱分析、通信分析、交易分析、活动轨迹分析等能力,支持案件配置、数据治理、离线地图和基站包本地化配置,便于在内网或专网环境中开展业务工作。
       </div>
@@ -39,12 +39,10 @@
   import { BasicModal, useModalInner } from '@/core/components/Modal';
   import { useDesign } from '@/core/hooks/web/useDesign';
   import { useGlobSetting } from '@/core/hooks/setting';
-  import { useElectronWindow } from '@/core/hooks/electron/useElectronWindow';
   import { useUserStore } from '@/core/store/modules/case';
 
   const { prefixCls } = useDesign('product-info-modal');
   const userStore = useUserStore();
-  const { getVersion } = useElectronWindow();
   const { title } = useGlobSetting();
   const { pkg } = __APP_INFO__;
 
@@ -56,10 +54,7 @@
     return cachedTitle.split('-')[0]?.trim() || cachedTitle;
   });
 
-  const appVersion = computed(() => {
-    return getVersion() || pkg.version || '';
-  });
-
+  const appVersion = computed(() => pkg.version || '');
 </script>
 
 <style lang="less">

+ 1 - 45
ai-frontend/src/core/layouts/default/setting/components/SettingFooter.vue

@@ -15,16 +15,6 @@
       修改密码
     </a-button>
 
-    <a-button block @click="openOfflineMapModal(true)" class="mt-3">
-      <EnvironmentOutlined class="mr-2" />
-      离线地图位置
-    </a-button>
-
-    <a-button block @click="openCellLocalModal(true)" class="mt-3">
-      <DatabaseOutlined class="mr-2" />
-      基站包路径
-    </a-button>
-
     <!-- <a-button type="primary" block @click="handleCopy">
       <CopyOutlined class="mr-2" />
       {{ t('layout.setting.copyBtn') }}
@@ -43,19 +33,15 @@
     <ChangeCasePasswordModal @register="registerChangeCasePasswordModal" />
     <ProductInfoModal @register="registerProductInfoModal" />
     <AuthorizationInfoModal @register="registerAuthorizationInfoModal" />
-    <OfflineMapModal @register="registerOfflineMapModal" />
-    <CellLocalModal @register="registerCellLocalModal" />
   </div>
 </template>
 <script lang="ts">
-  import { defineComponent, nextTick, onBeforeUnmount, onMounted, unref } from 'vue';
+  import { defineComponent, nextTick, unref } from 'vue';
 
   import {
     CopyOutlined,
     RedoOutlined,
     LockOutlined,
-    EnvironmentOutlined,
-    DatabaseOutlined,
     InfoCircleOutlined,
     SafetyCertificateOutlined,
   } from '@ant-design/icons-vue';
@@ -77,13 +63,10 @@
   import { updateGrayMode } from '@/core/logics/theme/updateGrayMode';
   import defaultSetting from '@/core/settings/projectSetting';
   import { router } from '@/core/router';
-  import { OPEN_CELL_LOCAL_MODAL_EVENT, OPEN_OFFLINE_MAP_MODAL_EVENT } from '@/core/logics/caseConfigGuide';
   import { cleanCache } from '../api';
   import ChangeCasePasswordModal from './ChangeCasePasswordModal.vue';
   import ProductInfoModal from './ProductInfoModal.vue';
   import AuthorizationInfoModal from './AuthorizationInfoModal.vue';
-  import OfflineMapModal from './OfflineMapModal.vue';
-  import CellLocalModal from './CellLocalModal.vue';
 
   export default defineComponent({
     name: 'SettingFooter',
@@ -91,15 +74,11 @@
       CopyOutlined,
       RedoOutlined,
       LockOutlined,
-      EnvironmentOutlined,
-      DatabaseOutlined,
       InfoCircleOutlined,
       SafetyCertificateOutlined,
       ChangeCasePasswordModal,
       ProductInfoModal,
       AuthorizationInfoModal,
-      OfflineMapModal,
-      CellLocalModal,
     },
     setup() {
       // const permissionStore = usePermissionStore();
@@ -113,15 +92,6 @@
       const [registerProductInfoModal, { openModal: openProductInfoModal }] = useModal();
       const [registerAuthorizationInfoModal, { openModal: openAuthorizationInfoModal }] = useModal();
       const [registerChangeCasePasswordModal, { openModal: openChangeCasePasswordModal }] = useModal();
-      const [registerOfflineMapModal, { openModal: openOfflineMapModal }] = useModal();
-      const [registerCellLocalModal, { openModal: openCellLocalModal }] = useModal();
-      const handleOpenOfflineMapModalByGuide = () => {
-        openOfflineMapModal(true);
-      };
-      const handleOpenCellLocalModalByGuide = () => {
-        openCellLocalModal(true);
-      };
-
       function handleCopy() {
         const { isSuccessRef } = useCopyToClipboard(JSON.stringify(unref(appStore.getProjectConfig), null, 2));
         unref(isSuccessRef) &&
@@ -159,16 +129,6 @@
         await tabStore.refreshPage(router);
       }
 
-      onMounted(() => {
-        window.addEventListener(OPEN_OFFLINE_MAP_MODAL_EVENT, handleOpenOfflineMapModalByGuide);
-        window.addEventListener(OPEN_CELL_LOCAL_MODAL_EVENT, handleOpenCellLocalModalByGuide);
-      });
-
-      onBeforeUnmount(() => {
-        window.removeEventListener(OPEN_OFFLINE_MAP_MODAL_EVENT, handleOpenOfflineMapModalByGuide);
-        window.removeEventListener(OPEN_CELL_LOCAL_MODAL_EVENT, handleOpenCellLocalModalByGuide);
-      });
-
       return {
         prefixCls,
         t,
@@ -181,10 +141,6 @@
         openAuthorizationInfoModal,
         registerChangeCasePasswordModal,
         openChangeCasePasswordModal,
-        registerOfflineMapModal,
-        openOfflineMapModal,
-        registerCellLocalModal,
-        openCellLocalModal,
       };
     },
   });

+ 53 - 27
ai-frontend/src/core/layouts/default/setting/components/UpgradeModal.vue

@@ -8,11 +8,25 @@
     @ok="handleSubmit"
   >
     <div :class="prefixCls">
-      <div class="upgrade-modal__tip">请选择升级文件,系统将按文件绝对路径执行升级。</div>
+      <div class="upgrade-modal__tip">
+        选择 zip 升级包并上传,系统将自动解压、覆盖数据库并执行升级 SQL(耗时较长,请耐心等待)。
+      </div>
+
+      <!-- Web 化:直接选择本机 zip 上传,不再由 Electron 提供服务端路径 -->
+      <input
+        ref="fileInputRef"
+        class="upgrade-modal__file-input"
+        type="file"
+        accept=".zip"
+        @change="handleFileChange"
+      />
 
-      <div class="upgrade-modal__file-box" @click="handleSelectFile">
+      <div class="upgrade-modal__file-box" @click="fileInputRef?.click()">
         <div class="upgrade-modal__file-value">
-          {{ filePath || '点击选择升级文件' }}
+          {{ fileName || '点击选择升级包(zip)' }}
+        </div>
+        <div v-if="uploadPercent > 0 && uploadPercent < 100" class="upgrade-modal__progress">
+          上传中 {{ uploadPercent }}%
         </div>
       </div>
     </div>
@@ -24,46 +38,46 @@
   import { BasicModal, useModalInner } from '@/core/components/Modal';
   import { useDesign } from '@/core/hooks/web/useDesign';
   import { useMessage } from '@/core/hooks/web/useMessage';
-  import { upgradeSystem } from '../api';
+  import { uploadUpgradePackage } from '../api';
 
   const { prefixCls } = useDesign('system-upgrade-modal');
   const { createMessage } = useMessage();
-  const filePath = ref('');
+  const fileName = ref('');
+  const uploadPercent = ref(0);
+  const fileInputRef = ref<HTMLInputElement | null>(null);
+  let selectedFile: File | null = null;
 
   const [registerModal, { closeModal, setModalProps }] = useModalInner(() => {
-    filePath.value = '';
+    fileName.value = '';
+    selectedFile = null;
+    uploadPercent.value = 0;
     setModalProps({ confirmLoading: false });
   });
 
-  async function handleSelectFile() {
-    const ipcRenderer = (window as any)?.electron?.ipcRenderer;
-    if (!ipcRenderer?.invoke) {
-      createMessage.error('无法获取文件路径,请在 Electron 环境下选择升级文件');
+  function handleFileChange(event: Event) {
+    const input = event.target as HTMLInputElement;
+    const file = input.files?.[0] || null;
+    input.value = '';
+    if (!file) return;
+    if (!file.name.toLowerCase().endsWith('.zip')) {
+      createMessage.error('升级包必须是 zip 文件');
       return;
     }
-    try {
-      const resolvedPath = await ipcRenderer.invoke('controller/effect/selectFile');
-      const filePaths = Array.isArray(resolvedPath)
-        ? resolvedPath.filter((item: unknown): item is string => typeof item === 'string' && !!item.trim())
-        : typeof resolvedPath === 'string' && resolvedPath.trim()
-          ? [resolvedPath]
-          : [];
-      if (!filePaths.length) return;
-      filePath.value = filePaths[0];
-    } catch (error: any) {
-      createMessage.error(error?.message || '选择升级文件失败,请稍后重试');
-    }
+    selectedFile = file;
+    fileName.value = file.name;
   }
 
   async function handleSubmit() {
-    if (!filePath.value) {
-      createMessage.warning('请先选择升级文件');
+    if (!selectedFile) {
+      createMessage.warning('请先选择升级包');
       return;
     }
     setModalProps({ confirmLoading: true });
     try {
-      await upgradeSystem(filePath.value);
-      createMessage.success('系统升级指令已提交');
+      await uploadUpgradePackage(selectedFile, (percent) => {
+        uploadPercent.value = percent;
+      });
+      createMessage.success('系统升级已完成');
       closeModal();
     } catch (error: any) {
       createMessage.error(error?.message || '系统升级失败,请稍后重试');
@@ -84,13 +98,25 @@
       color: #6b7280;
     }
 
+    .upgrade-modal__file-input {
+      display: none;
+    }
+
+    .upgrade-modal__progress {
+      margin-top: 8px;
+      font-size: 13px;
+      color: #1677ff;
+    }
+
     .upgrade-modal__file-box {
       padding: 14px;
       cursor: pointer;
       background: #f8fafc;
       border: 1px solid #e5e7eb;
       border-radius: 10px;
-      transition: border-color 0.2s ease, background-color 0.2s ease;
+      transition:
+        border-color 0.2s ease,
+        background-color 0.2s ease;
 
       &:hover {
         background: #f1f5f9;

+ 0 - 2
ai-frontend/src/core/layouts/default/setting/components/index.ts

@@ -10,5 +10,3 @@ export const UpgradeModal = createAsyncComponent(() => import('./UpgradeModal.vu
 export const AuthorizationInfoModal = createAsyncComponent(() => import('./AuthorizationInfoModal.vue'));
 export const ProductInfoModal = createAsyncComponent(() => import('./ProductInfoModal.vue'));
 export const ChangeCasePasswordModal = createAsyncComponent(() => import('./ChangeCasePasswordModal.vue'));
-export const OfflineMapModal = createAsyncComponent(() => import('./OfflineMapModal.vue'));
-export const CellLocalModal = createAsyncComponent(() => import('./CellLocalModal.vue'));

+ 7 - 6
ai-frontend/src/core/logics/caseConfigGuide.ts

@@ -1,18 +1,19 @@
 import { initCellLocalPathFromServer } from '@/core/utils/cell/cellLocalInit';
-import { hydratePersistedCaseGlobalConfig } from '@/core/utils/caseGlobalConfig';
 import { initOfflineMapDirFromServer } from '@/core/utils/map/offlineMapInit';
 
 export const OPEN_SETTING_DRAWER_EVENT = 'layout-setting:open-drawer';
-export const OPEN_OFFLINE_MAP_MODAL_EVENT = 'layout-setting:open-offline-map-modal';
-export const OPEN_CELL_LOCAL_MODAL_EVENT = 'layout-setting:open-cell-local-modal';
 
 let globalCaseConfigInitPromise: Promise<void> | null = null;
 
+/**
+ * 初始化案件级全局配置:离线地图目录、基站包路径都从后端配置读取。
+ *
+ * <p>Web 化后不再通过 Electron 读写本机配置文件,服务端配置由运维通过
+ * {@code /sys/mapLocal}、{@code /sys/cellLocal} 或 {@code QingJian/conf/c5e503ad.json} 设置。
+ */
 export function initGlobalCaseConfig() {
   if (!globalCaseConfigInitPromise) {
-    globalCaseConfigInitPromise = hydratePersistedCaseGlobalConfig()
-      .catch(() => undefined)
-      .then(() => Promise.all([initOfflineMapDirFromServer(), initCellLocalPathFromServer()]))
+    globalCaseConfigInitPromise = Promise.all([initOfflineMapDirFromServer(), initCellLocalPathFromServer()])
       .then(() => undefined)
       .catch(() => undefined);
   }

+ 0 - 63
ai-frontend/src/core/utils/caseGlobalConfig.ts

@@ -1,63 +0,0 @@
-import { getCellLocalPath, setCellLocalPath } from './cell/cellLocal';
-import { getOfflineMapDir, setOfflineMapDir } from './map/offlineMap';
-
-type PersistedCaseGlobalConfig = {
-  offlineMapDir?: string;
-  cellLocalPath?: string;
-};
-
-const normalizeText = (value: unknown) => String(value ?? '').trim();
-const isPlainObject = (value: unknown): value is Record<string, unknown> =>
-  Object.prototype.toString.call(value) === '[object Object]';
-
-export async function readPersistedCaseGlobalConfig(): Promise<PersistedCaseGlobalConfig> {
-  const ipcRenderer = (window as any)?.electron?.ipcRenderer;
-  if (!ipcRenderer?.invoke) return {};
-
-  try {
-    const payload = await ipcRenderer.invoke('controller/os/readCaseGlobalConfig');
-    if (!isPlainObject(payload)) return {};
-    return {
-      offlineMapDir: normalizeText(payload.offlineMapDir),
-      cellLocalPath: normalizeText(payload.cellLocalPath),
-    };
-  } catch {
-    return {};
-  }
-}
-
-export async function writePersistedCaseGlobalConfig(patch: Partial<PersistedCaseGlobalConfig>): Promise<boolean> {
-  const ipcRenderer = (window as any)?.electron?.ipcRenderer;
-  if (!ipcRenderer?.invoke) return false;
-
-  try {
-    const payload: Partial<PersistedCaseGlobalConfig> = {};
-    if (Object.prototype.hasOwnProperty.call(patch, 'offlineMapDir')) {
-      payload.offlineMapDir = normalizeText(patch.offlineMapDir);
-    }
-    if (Object.prototype.hasOwnProperty.call(patch, 'cellLocalPath')) {
-      payload.cellLocalPath = normalizeText(patch.cellLocalPath);
-    }
-    return !!(await ipcRenderer.invoke('controller/os/writeCaseGlobalConfig', payload));
-  } catch {
-    return false;
-  }
-}
-
-export async function hydratePersistedCaseGlobalConfig() {
-  const config = await readPersistedCaseGlobalConfig();
-  const offlineMapDir = normalizeText(config.offlineMapDir);
-  const cellLocalPath = normalizeText(config.cellLocalPath);
-
-  if (offlineMapDir && !getOfflineMapDir()) {
-    setOfflineMapDir(offlineMapDir);
-  }
-  if (cellLocalPath && !getCellLocalPath()) {
-    setCellLocalPath(cellLocalPath);
-  }
-
-  return {
-    offlineMapDir: getOfflineMapDir(),
-    cellLocalPath: getCellLocalPath(),
-  };
-}

+ 64 - 54
ai-frontend/src/core/utils/map/offlineMap.ts

@@ -1,7 +1,71 @@
+import { useGlobSetting } from '@/core/hooks/setting';
+
 const OFFLINE_MAP_DIR_KEY = 'OFFLINE_MAP_DIR__';
 const OFFLINE_MAP_SERVER_DIR_KEY = 'OFFLINE_MAP_SERVER_DIR__';
 export const OFFLINE_MAP_DIR_CHANGED_EVENT = 'offline-map-dir-changed';
 const LOCAL_MAP_PROTOCOL = 'localmap://';
+const PMTILES_PROTOCOL = 'pmtiles://';
+
+/** 后端可达前缀(与 ai/utils/constants.ts 的 resolveApiUrl 同一套约定:apiUrl + urlPrefix + adminPath) */
+const buildApiUrl = (path: string) => {
+  const { apiUrl, urlPrefix, adminPath } = useGlobSetting();
+  const prefix = `${apiUrl || ''}${urlPrefix || ''}${adminPath || ''}`.replace(/\/+$/, '');
+  return `${prefix}${path.startsWith('/') ? path : `/${path}`}`;
+};
+
+/**
+ * 离线地图瓦片(china.pmtiles)的 Web 访问地址。
+ *
+ * <p>Web 化改造:瓦片放在**服务端**离线地图目录(系统配置 mapLocal)里,
+ * 由后端 `GET /sys/map/pmtiles` 支持 HTTP Range 按块返回,替代原 Electron 的 ipc 读取。
+ */
+export const getOfflineMapPmtilesUrl = () => buildApiUrl('/sys/map/pmtiles');
+
+/** 离线地图自定义样式(配置目录里的 behavior-spacetime-style.json)的访问地址 */
+export const getOfflineMapStyleUrl = () => buildApiUrl('/sys/map/style');
+
+/** 前端静态资源目录里的兜底瓦片地址(public/resource/map/china.pmtiles,未配置服务端目录时使用) */
+export const getBuiltinPmtilesUrl = () =>
+  new URL('resource/map/china.pmtiles', new URL(import.meta.env.BASE_URL || './', window.location.href)).toString();
+
+/**
+ * 通过 HTTP Range 读取 PMTiles 的 Source 实现(替代原 ElectronPmtilesSource)。
+ *
+ * <p>PMTiles 只要求实现 {@code getKey()} 与 {@code getBytes(offset, length)};
+ * 地图样式里的 source url 写成 {@code pmtiles://<本类的 url>} 即会按需分块拉取。
+ */
+export class HttpPmtilesSource {
+  url: string;
+
+  constructor(url: string) {
+    this.url = String(url || '').trim();
+  }
+
+  getKey() {
+    return this.url;
+  }
+
+  async getBytes(offset: number, length: number) {
+    if (!this.url || !length) {
+      return { data: new ArrayBuffer(0) };
+    }
+    try {
+      const response = await fetch(this.url, {
+        headers: { Range: `bytes=${offset}-${offset + length - 1}` },
+      });
+      if (!response.ok && response.status !== 206) {
+        return { data: new ArrayBuffer(0) };
+      }
+      return { data: await response.arrayBuffer() };
+    } catch {
+      return { data: new ArrayBuffer(0) };
+    }
+  }
+}
+
+/** 注册离线地图瓦片源:配置了服务端目录用后端 Range 接口,否则退回前端静态资源 */
+export const resolveOfflinePmtilesUrls = () =>
+  [getOfflineMapDir() ? getOfflineMapPmtilesUrl() : '', getBuiltinPmtilesUrl()].filter(Boolean);
 
 function isValidOfflineMapPath(value: string) {
   const text = String(value || '').trim();
@@ -89,24 +153,6 @@ export function buildFileUrl(filePath: string) {
   return encodeURI(`${LOCAL_MAP_PROTOCOL}${normalized.startsWith('/') ? '' : '/'}${normalized}`);
 }
 
-export function getOfflineMapPmtilesUrl(fileName = 'china.pmtiles') {
-  const dir = getOfflineMapDir();
-  if (!dir) return '';
-  return buildFileUrl(`${dir}/${fileName}`);
-}
-
-export function getOfflineMapFileUrl(fileName: string) {
-  const dir = getOfflineMapDir();
-  if (!dir || !fileName) return '';
-  return buildFileUrl(`${dir}/${fileName}`);
-}
-
-export function getOfflineMapFilePath(fileName: string) {
-  const dir = getOfflineMapDir();
-  if (!dir || !fileName) return '';
-  return normalizePath(`${dir}/${fileName}`);
-}
-
 export function toLocalMapUrl(value: string) {
   const text = String(value || '').trim();
   if (!text) return '';
@@ -126,39 +172,3 @@ export function toLocalMapUrl(value: string) {
   }
   return text;
 }
-
-export class ElectronPmtilesSource {
-  filePath: string;
-
-  constructor(filePath: string) {
-    this.filePath = normalizePath(filePath);
-  }
-
-  getKey() {
-    return this.filePath;
-  }
-
-  async getBytes(offset: number, length: number) {
-    const ipcRenderer = (window as any)?.electron?.ipcRenderer;
-    if (!ipcRenderer?.invoke || !this.filePath || !length) {
-      return { data: new ArrayBuffer(0) };
-    }
-    const payload =
-      (await ipcRenderer.invoke('controller/os/readBinaryFileRange', {
-        filePath: this.filePath,
-        offset,
-        length,
-      })) || {};
-    const base64 = String(payload?.data || '');
-    const size = Number(payload?.size || 0);
-    if (!base64 || !size) {
-      return { data: new ArrayBuffer(0) };
-    }
-    const binary = window.atob(base64);
-    const bytes = new Uint8Array(binary.length);
-    for (let index = 0; index < binary.length; index += 1) {
-      bytes[index] = binary.charCodeAt(index);
-    }
-    return { data: bytes.buffer };
-  }
-}

+ 24 - 0
ai-frontend/src/graph/api/analysis.ts

@@ -1332,3 +1332,27 @@ export const deleteGraphHistory = async (params: GraphHistoryDeleteQuery): Promi
     },
   );
 };
+
+/**
+ * 读取关系图历史快照内容(Web 化:按历史ID读取服务端文件,不再走 Electron ipc 读本机文件)。
+ */
+export const fetchGraphHistoryContent = async (id: string | number): Promise<string> => {
+  return defHttp.get<string>(
+    { url: adminPath + `/graph/history/${encodeURIComponent(String(id))}/content` },
+    { skipSuccessMessage: true },
+  );
+};
+
+/**
+ * 保存关系图历史快照内容(Web 化:按历史ID写入服务端文件,不再走 Electron ipc 写本机文件)。
+ */
+export const saveGraphHistoryContent = async (id: string | number, content: string): Promise<void> => {
+  // postJson:以 application/json 发送(form-urlencoded 会对 JSON 字符串做 qs 编码导致内容损坏)
+  await defHttp.postJson<void>(
+    {
+      url: adminPath + `/graph/history/${encodeURIComponent(String(id))}/content`,
+      data: content,
+    },
+    { skipSuccessMessage: true },
+  );
+};

+ 37 - 57
ai-frontend/src/graph/views/graph/index.vue

@@ -626,9 +626,11 @@
     fetchGraphAnalysis,
     fetchGraphCallDetail,
     fetchGraphHistory,
+    fetchGraphHistoryContent,
     fetchGraphNodeDetail,
     fetchGraphTransDetail,
     resolveGraphRespondentsFromRouteQuery,
+    saveGraphHistoryContent,
   } from '../../api/analysis';
   import type {
     AnalysisLayoutWorkerPayload,
@@ -5996,8 +5998,6 @@
     window.localStorage.setItem(STORAGE_KEY, JSON.stringify(savedLayouts.value));
   };
 
-  const getElectronIpcRenderer = () => (window as any)?.electron?.ipcRenderer;
-
   const normalizeHistoryPayload = (value: unknown) => {
     if (!value) return '';
     if (typeof value === 'string') return value;
@@ -6032,6 +6032,32 @@
     return normalizedValue;
   };
 
+  /** 从历史记录(或嵌套结构)中提取图谱历史ID(file_info/graph_his 主键,Long 序列化为字符串) */
+  const extractGraphHistoryId = (source: unknown, depth = 0): string => {
+    if (depth > 5 || source === null || source === undefined) return '';
+    if (typeof source === 'string' || typeof source === 'number') {
+      const text = String(source).trim();
+      return /^\d{10,20}$/.test(text) ? text : '';
+    }
+    if (Array.isArray(source)) {
+      for (const item of source) {
+        const matched = extractGraphHistoryId(item, depth + 1);
+        if (matched) return matched;
+      }
+      return '';
+    }
+    if (typeof source !== 'object') return '';
+    for (const key of ['id', 'graphHisId', 'historyId']) {
+      const matched = extractGraphHistoryId((source as Recordable)[key], depth + 1);
+      if (matched) return matched;
+    }
+    for (const key of ['data', 'result', 'record', 'rows', 'list']) {
+      const matched = extractGraphHistoryId((source as Recordable)[key], depth + 1);
+      if (matched) return matched;
+    }
+    return '';
+  };
+
   const extractGraphHistoryFilePath = (source: unknown, depth = 0): string => {
     if (depth > 5 || source === null || source === undefined) return '';
 
@@ -6085,47 +6111,6 @@
     return '';
   };
 
-  const writeGraphHistoryPayloadToFile = async (filePath: string, payload: string) => {
-    const ipcRenderer = getElectronIpcRenderer();
-    if (!ipcRenderer?.invoke) {
-      throw new Error('当前环境不支持写入关系图历史文件');
-    }
-
-    const writeResult = await ipcRenderer.invoke('controller/os/writeTextFile', {
-      filePath,
-      content: payload,
-      encoding: 'utf8',
-    });
-
-    const writeSuccess =
-      writeResult === true ||
-      (typeof writeResult === 'string' && looksLikeGraphHistoryFilePath(writeResult)) ||
-      Boolean((writeResult as Recordable | undefined)?.success);
-
-    if (!writeSuccess) {
-      throw new Error('关系图历史文件写入失败');
-    }
-  };
-
-  const readGraphHistoryPayloadFromFile = async (filePath: string) => {
-    const normalizedPath = normalizeGraphHistoryFilePath(filePath);
-    if (!normalizedPath) return '';
-
-    const ipcRenderer = getElectronIpcRenderer();
-    if (!ipcRenderer?.invoke) return '';
-
-    try {
-      const payload = await ipcRenderer.invoke('controller/os/readTextFile', {
-        filePath: normalizedPath,
-        encoding: 'utf8',
-      });
-      return normalizeHistoryPayload(payload);
-    } catch (error) {
-      console.error('读取关系图历史文件失败', normalizedPath, error);
-      return '';
-    }
-  };
-
   const resolveGraphHistoryPayload = async (source?: Partial<GraphHistoryItem> | Recordable | null) => {
     const record = (source || {}) as Recordable;
     const inlinePayload = normalizeHistoryPayload(
@@ -6136,14 +6121,11 @@
       return inlinePayload;
     }
 
-    const filePath =
-      inlinePayload && looksLikeGraphHistoryFilePath(inlinePayload)
-        ? normalizeGraphHistoryFilePath(inlinePayload)
-        : extractGraphHistoryFilePath(record);
+    // Web 化:历史内容保存在服务端文件里,按历史记录ID通过后端接口读取
+    const historyId = record.remoteId ?? record.id ?? extractGraphHistoryId(record);
+    if (!historyId) return '';
 
-    if (!filePath) return '';
-
-    return readGraphHistoryPayloadFromFile(filePath);
+    return fetchGraphHistoryContent(String(historyId));
   };
 
   const pickGraphHistoryList = (source: any): GraphHistoryItem[] => {
@@ -6236,13 +6218,12 @@
     };
 
     const createResult = await createGraphHistory(commonParams);
-    const filePath = extractGraphHistoryFilePath(createResult);
-
-    if (!filePath) {
-      throw new Error('未获取到关系图历史文件路径');
+    const historyId = createResult?.id ?? createResult?.data?.id;
+    if (!historyId) {
+      throw new Error('未获取到关系图历史ID');
     }
 
-    await writeGraphHistoryPayloadToFile(filePath, snapshot.payload);
+    await saveGraphHistoryContent(String(historyId), snapshot.payload);
   };
 
   const addEntityNode = (
@@ -8232,8 +8213,7 @@
     const snapshot = savedLayouts.value.find((item) => item.id === snapshotId);
     if (!snapshot) return;
 
-    const payload =
-      snapshot.payload || (snapshot.filePath ? await readGraphHistoryPayloadFromFile(snapshot.filePath) : '');
+    const payload = snapshot.payload || (snapshot.remoteId ? await fetchGraphHistoryContent(snapshot.remoteId) : '');
     if (!payload) {
       createMessage.error('历史布局内容读取失败');
       return;

+ 29 - 36
ai-frontend/src/plat/views/authorization/index.vue

@@ -2,11 +2,7 @@
   <div :class="prefixCls" class="authorization-page">
     <div class="case-header-bar flex items-center justify-between">
       <AppLogo :showTitle="true" />
-      <div class="flex items-center">
-        <WindowMinimize />
-        <WindowMaximize />
-        <WindowClose />
-      </div>
+      <div class="flex items-center"> </div>
     </div>
     <div class="authorization-content">
       <section class="left-pane">
@@ -140,20 +136,28 @@
               </div>
 
               <div class="upload-panel">
-                <div class="upload-panel__dropzone" @click="handleSelectLicenseFile">
+                <!-- Web 化:直接选择本机文件上传,不再通过 Electron 读取本机路径 -->
+                <input
+                  ref="licenseFileInputRef"
+                  class="upload-panel__file-input"
+                  type="file"
+                  accept=".xlts"
+                  @change="handleLicenseFileChange"
+                />
+                <div class="upload-panel__dropzone" @click="licenseFileInputRef?.click()">
                   <UploadOutlined class="upload-panel__dropzone-icon" />
                   <span class="upload-panel__dropzone-text">
-                    {{ licenseFilePath || '请选择离线授权文件' }}
+                    {{ licenseFileName || '请选择离线授权文件' }}
                   </span>
                 </div>
 
                 <div class="upload-panel__actions">
-                  <Button class="ui-btn ui-btn--ghost" @click="handleSelectLicenseFile">选择授权文件</Button>
+                  <Button class="ui-btn ui-btn--ghost" @click="licenseFileInputRef?.click()">选择授权文件</Button>
                   <Button
                     type="primary"
                     class="ui-btn ui-btn--primary"
                     :loading="offlineAuthorizationLoading"
-                    :disabled="!licenseFilePath"
+                    :disabled="!licenseFile"
                     @click="handleOfflineAuthorization"
                   >
                     离线授权
@@ -169,7 +173,7 @@
 </template>
 
 <script lang="ts" setup>
-  import { onMounted, ref } from 'vue';
+  import { computed, onMounted, ref } from 'vue';
   import { useRoute, useRouter } from 'vue-router';
   import { Button } from 'ant-design-vue';
   import {
@@ -183,18 +187,12 @@
     UploadOutlined,
   } from '@ant-design/icons-vue';
   import { PageEnum } from '@/core/enums/pageEnum';
-  import {
-    authorizationInfoApi,
-    checkAuthApi,
-    machineCodeApi,
-    offlineAuthorizationApi,
-  } from '@/core/api/sys/login';
+  import { authorizationInfoApi, checkAuthApi, machineCodeApi, offlineAuthorizationApi } from '@/core/api/sys/login';
   import { useCopyToClipboard } from '@/core/hooks/web/useCopyToClipboard';
   import { useDesign } from '@/core/hooks/web/useDesign';
   import { useMessage } from '@/core/hooks/web/useMessage';
   import { useUserStore } from '@/core/store/modules/case';
   import { AppLogo } from '@/core/components/Application';
-  import { WindowMinimize, WindowMaximize, WindowClose } from '@/core/layouts/default/header/components';
   import { initGlobalCaseConfig } from '@/core/logics/caseConfigGuide';
   import {
     extractAuthorizationCache,
@@ -212,7 +210,10 @@
   const machineCode = ref('');
   const machineCodeLoading = ref(false);
   const offlineAuthorizationLoading = ref(false);
-  const licenseFilePath = ref('');
+  /** 用户选择的授权文件(Web 化:直接上传文件内容,不再传服务端路径) */
+  const licenseFile = ref<File | null>(null);
+  const licenseFileInputRef = ref<HTMLInputElement | null>(null);
+  const licenseFileName = computed(() => licenseFile.value?.name || '');
   const authorizationWarningMessage = ref('');
 
   const capabilityList = [
@@ -310,34 +311,26 @@
     }
   }
 
-  async function handleSelectLicenseFile() {
-    const ipcRenderer = (window as any)?.electron?.ipcRenderer;
-    if (!ipcRenderer?.invoke) {
-      showMessage('无法获取文件路径,请在 Electron 环境下选择授权文件');
+  function handleLicenseFileChange(event: Event) {
+    const input = event.target as HTMLInputElement;
+    const file = input.files?.[0] || null;
+    input.value = '';
+    if (!file) return;
+    if (!file.name.toLowerCase().endsWith('.xlts')) {
+      showMessage('请选择 .xlts 结尾的授权文件');
       return;
     }
-    try {
-      const resolvedPath = await ipcRenderer.invoke('controller/effect/selectFile');
-      const filePaths = Array.isArray(resolvedPath)
-        ? resolvedPath.filter((item: unknown): item is string => typeof item === 'string' && !!item.trim())
-        : typeof resolvedPath === 'string' && resolvedPath.trim()
-          ? [resolvedPath]
-          : [];
-      if (!filePaths.length) return;
-      licenseFilePath.value = filePaths[0];
-    } catch (error: any) {
-      showMessage(error?.message || '选择授权文件失败,请稍后重试');
-    }
+    licenseFile.value = file;
   }
 
   async function handleOfflineAuthorization() {
-    if (!licenseFilePath.value) {
+    if (!licenseFile.value) {
       showMessage('请先选择授权文件');
       return;
     }
     offlineAuthorizationLoading.value = true;
     try {
-      const res = await offlineAuthorizationApi(licenseFilePath.value);
+      const res = await offlineAuthorizationApi(licenseFile.value);
       authorizationWarningMessage.value = '';
       if (res?.code === 200) {
         const entered = await checkAuthAndEnterSystem();

+ 1 - 6
ai-frontend/src/plat/views/case/case.vue

@@ -2,11 +2,7 @@
   <div :class="prefixCls" class="relative flex h-full min-h-0 w-full flex-col overflow-hidden bg-light-400">
     <div class="case-header-bar flex items-center justify-between">
       <AppLogo :showTitle="true" />
-      <div class="flex items-center">
-        <WindowMinimize />
-        <WindowMaximize />
-        <WindowClose />
-      </div>
+      <div class="flex items-center"> </div>
     </div>
     <div class="container relative mx-auto flex h-full min-h-0 flex-1 flex-col py-2">
       <div class="flex h-full min-h-0 flex-col">
@@ -165,7 +161,6 @@
   import { useUserStore } from '@/core/store/modules/case';
   import { useModal } from '@/core/components/Modal';
   import { AppLogo, AppSearch } from '@/core/components/Application';
-  import { WindowMinimize, WindowMaximize, WindowClose } from '@/core/layouts/default/header/components';
   import { list, deleteById } from '@/plat/api/case/caseApi';
   import type { CaseInfo } from '@/plat/api/case/caseApi';
   import CaseForm from './CaseForm.vue';

+ 25 - 1
ai-frontend/src/trans/api/baseStationQueryApi.ts

@@ -101,10 +101,34 @@ export interface BaseStationConvertResponse {
   result?: string | Recordable | null;
 }
 
-
 export const searchBaseStation = (params: BaseStationSearchParams) =>
   defHttp.get<BaseStationSearchResponse>({ url: adminPath + '/tower/qry', params });
 
+/**
+ * 上传基站 xls 并转换(Web 化:文件上传到后端转换,结果以附件流返回)。
+ * 返回原始 AxiosResponse:data 为转换结果 xlsx(blob),出错时为 JSON 错误体。
+ */
+export const uploadBaseStationConvert = (file: File, onUploadProgress?: (percent: number) => void) =>
+  defHttp.uploadFile<Blob>(
+    {
+      url: ctxAdminPath + '/tower/covFile',
+      responseType: 'blob',
+      timeout: 5 * 60 * 1000,
+      onUploadProgress: (progressEvent: AxiosProgressEvent) => {
+        if (!onUploadProgress || !progressEvent.total) return;
+        onUploadProgress(Math.round((progressEvent.loaded * 100) / progressEvent.total));
+      },
+    },
+    { name: 'file', file, filename: file.name },
+  );
+
+/** 下载基站转换模板(Web 化:模板文件以附件流返回) */
+export const downloadBaseStationTemplate = (): Promise<AxiosResponse<Blob>> =>
+  defHttp.get<AxiosResponse<Blob>>(
+    { url: ctxAdminPath + '/tower/template', responseType: 'blob', timeout: 3 * 60 * 1000 },
+    { isReturnNativeResponse: true, errorMessageMode: 'none' },
+  );
+
 export const importBaseStationFile = (
   params: UploadFileParams,
   onUploadProgress: (progressEvent: AxiosProgressEvent) => void,

+ 22 - 21
ai-frontend/src/trans/views/aiBaseStation/components/BaseStationQueryMap.vue

@@ -12,9 +12,11 @@
   import { computed, nextTick, onActivated, onBeforeUnmount, onMounted, ref, watch } from 'vue';
   import { useDesign } from '@/core/hooks/web/useDesign';
   import {
-    ElectronPmtilesSource,
+    HttpPmtilesSource,
     getOfflineMapDir,
-    getOfflineMapFilePath,
+    getOfflineMapPmtilesUrl,
+    getOfflineMapStyleUrl,
+    resolveOfflinePmtilesUrls,
     OFFLINE_MAP_DIR_CHANGED_EVENT,
     toLocalMapUrl,
   } from '@/core/utils/map/offlineMap';
@@ -101,10 +103,10 @@
   };
 
   const ensureOfflinePmtilesArchive = () => {
-    const filePath = getOfflineMapFilePath('china.pmtiles');
-    if (!pmtilesProtocol || !filePath) return;
-    if (pmtilesProtocol.get(filePath)) return;
-    pmtilesProtocol.add(new PMTiles(new ElectronPmtilesSource(filePath) as any));
+    if (!pmtilesProtocol) return;
+    resolveOfflinePmtilesUrls().forEach((url) => {
+      if (!pmtilesProtocol?.get(url)) pmtilesProtocol?.add(new PMTiles(new HttpPmtilesSource(url) as any));
+    });
   };
 
   const getPublicBaseUrl = () => new URL(import.meta.env.BASE_URL || './', window.location.href).toString();
@@ -149,15 +151,15 @@
 
   const buildExternalMapStyle = () => {
     const offlineMapDir = getOfflineMapDir();
-    const pmtilesFilePath = getOfflineMapFilePath('china.pmtiles');
-    if (!offlineMapDir || !pmtilesFilePath) return null;
+    const pmtilesUrl = getOfflineMapDir() ? getOfflineMapPmtilesUrl() : '';
+    if (!offlineMapDir || !pmtilesUrl) return null;
     return {
       version: 8,
       name: 'base-station-query-offline-style',
       sources: {
         'behavior-basemap': {
           type: 'vector',
-          url: `${PMTILES_PROTOCOL}${pmtilesFilePath}`,
+          url: `${PMTILES_PROTOCOL}${pmtilesUrl}`,
         },
       },
       layers: [
@@ -220,14 +222,13 @@
     };
   };
 
-  const getOfflineMapStylePath = () => getOfflineMapFilePath('behavior-spacetime-style.json');
-
+  /** 读取服务端配置目录里的自定义样式(Web:走后端 /sys/map/style,替代原 Electron ipc 读文件) */
   const readOfflineMapStyle = async () => {
-    const ipcRenderer = (window as any)?.electron?.ipcRenderer;
-    const filePath = getOfflineMapStylePath();
-    if (!ipcRenderer?.invoke || !filePath) return '';
+    if (!getOfflineMapDir()) return '';
     try {
-      return (await ipcRenderer.invoke('controller/os/readTextFile', { filePath, encoding: 'utf8' })) || '';
+      const response = await fetch(getOfflineMapStyleUrl(), { cache: 'no-store' });
+      if (!response.ok) return '';
+      return await response.text();
     } catch {
       return '';
     }
@@ -236,12 +237,12 @@
   const resolveStyle = async () => {
     const customStyle = (window as BaseStationWindow).__BEHAVIOR_SPACETIME_STYLE__ || STYLE_PATH;
     try {
-      const offlinePmtilesFilePath = getOfflineMapFilePath('china.pmtiles');
-      const offlineStylePath = getOfflineMapStylePath();
-      if (getOfflineMapDir() && offlinePmtilesFilePath && offlineStylePath) {
+      const offlinePmtilesUrl = getOfflineMapDir() ? getOfflineMapPmtilesUrl() : '';
+      const offlineStyleUrl = getOfflineMapStyleUrl();
+      if (getOfflineMapDir() && offlinePmtilesUrl && offlineStyleUrl) {
         const styleText = await readOfflineMapStyle();
         if (styleText) {
-          return normalizePmtilesSources(JSON.parse(styleText), offlineStylePath, offlinePmtilesFilePath);
+          return normalizePmtilesSources(JSON.parse(styleText), offlineStyleUrl, offlinePmtilesUrl);
         }
       }
 
@@ -251,14 +252,14 @@
       }
 
       if (customStyle && typeof customStyle === 'object') {
-        return normalizePmtilesSources(customStyle, window.location.href, offlinePmtilesFilePath || undefined);
+        return normalizePmtilesSources(customStyle, window.location.href, offlinePmtilesUrl || undefined);
       }
 
       const styleUrl = resolveStyleAssetUrl(String(customStyle), window.location.href);
       const response = await fetch(styleUrl, { cache: 'no-store' });
       if (!response.ok) throw new Error(`style request failed: ${response.status}`);
       const style = await response.json();
-      return normalizePmtilesSources(style, response.url || styleUrl, offlinePmtilesFilePath || undefined);
+      return normalizePmtilesSources(style, response.url || styleUrl, offlinePmtilesUrl || undefined);
     } catch (error) {
       errorMsg.value = error instanceof Error ? error.message : 'map style error';
       return getFallbackStyle();

+ 54 - 100
ai-frontend/src/trans/views/aiBaseStation/index.vue

@@ -40,8 +40,16 @@
           <Button @click="handleReset">重置</Button>
         </div>
         <div class="side-actions">
-          <Button @click="handleFetchTemplate">获取转换基站模版</Button>
-          <Button @click="handleConvertFile">批量转换基站</Button>
+          <!-- Web 化:模版与转换结果都通过浏览器下载,不再依赖 Electron 打开本机目录 -->
+          <Button :loading="templateLoading" @click="handleFetchTemplate">下载转换基站模版</Button>
+          <Button :loading="convertLoading" @click="convertFileInputRef?.click()">批量转换基站</Button>
+          <input
+            ref="convertFileInputRef"
+            class="side-actions__file-input"
+            type="file"
+            accept=".xls,.xlsx"
+            @change="handleConvertFileChange"
+          />
         </div>
       </div>
     </div>
@@ -73,13 +81,13 @@
   import { useMessage } from '@/core/hooks/web/useMessage';
   import { useTableSkill } from '@/core/hooks/web/useTableSkill';
   import {
-    convertBaseStationData,
-    fetchBaseStationTemplatePath,
+    downloadBaseStationTemplate,
     searchBaseStation,
+    uploadBaseStationConvert,
     type BaseStationSearchLocation,
     type BaseStationSearchResponse,
-    type BaseStationTemplateResponse,
   } from '@/trans/api/baseStationQueryApi';
+  import { downloadByData, resolveDownloadErrorMessage } from '@/core/utils/file/download';
   import BaseStationQueryMap, { type BaseStationMapPoint } from './components/BaseStationQueryMap.vue';
 
   type RadixMode = 'dec' | 'hex';
@@ -108,10 +116,12 @@
   });
 
   const mapPoints = ref<BaseStationMapPoint[]>([]);
+  const templateLoading = ref(false);
+  const convertLoading = ref(false);
+  const convertFileInputRef = ref<HTMLInputElement | null>(null);
 
   const normalizeText = (value: unknown) => String(value ?? '').trim();
   const getCarrierLabel = (value: string) => carrierOptions.find((item) => item.value === value)?.label || '未知运营商';
-  const ipcRenderer = window.electron?.ipcRenderer;
 
   const resultSummary = computed(() => {
     if (!mapPoints.value.length) return '当前无可展示的基站坐标数据。';
@@ -211,72 +221,22 @@
     } satisfies BaseStationMapPoint;
   };
 
-  const resolveTemplatePath = (payload: BaseStationTemplateResponse | null | undefined): string => {
-    if (!payload) return '';
-    if (typeof payload === 'string') return normalizeText(payload);
-
-    const candidates = [
-      payload.data,
-      payload.path,
-      payload.filePath,
-      payload.file,
-      payload.message,
-      payload.msg,
-      (payload.data as Recordable | null | undefined)?.path,
-      (payload.data as Recordable | null | undefined)?.filePath,
-      (payload.data as Recordable | null | undefined)?.file,
-    ];
-
-    for (const candidate of candidates) {
-      const text = normalizeText(candidate);
-      if (text) return text;
-    }
-    return '';
-  };
-
-  const openDirectoryByPath = async (targetPath: string) => {
-    if (!ipcRenderer?.invoke) {
-      createMessage.warning(`当前不在 Electron 环境,路径为:${targetPath}`);
-      return;
-    }
-
-    const opened = await ipcRenderer.invoke('controller/os/openDirectory', { id: targetPath });
-    if (!opened) {
-      throw new Error('打开文件夹失败');
-    }
-  };
-
+  /** 下载转换基站模版(Web 化:模板文件以附件流返回,浏览器直接另存) */
   const handleFetchTemplate = async () => {
-    await runWithQueryLoading(async () => {
-      const response = await fetchBaseStationTemplatePath();
-      const code = typeof response === 'object' && response ? Number(response.code ?? 200) : 200;
-      if (code !== 200) {
-        throw new Error(
-          (typeof response === 'object' && response && (response.message || response.msg)) || '获取导入模版失败',
-        );
-      }
-
-      const templatePath = resolveTemplatePath(response);
-      if (!templatePath) {
-        throw new Error('未获取到转换基站模版路径');
+    templateLoading.value = true;
+    try {
+      const response = await downloadBaseStationTemplate();
+      const blob = response?.data;
+      if (!(blob instanceof Blob)) {
+        throw new Error('模版下载失败');
       }
-
-      createConfirm({
-        title: '已获取转换基站模版',
-        content: `模版路径为:<br/>${templatePath}<br/><br/>点击确定后将打开所在文件夹。`,
-        iconType: 'success',
-        okText: '打开文件夹',
-        cancelText: '关闭',
-        async onOk() {
-          await openDirectoryByPath(templatePath);
-          return Promise.resolve();
-        },
-      });
-    }).catch((error: any) => {
-      createMessage.error(error?.message || '获取转换基站模版失败');
-    });
+      downloadByData(blob, '基站导入模板.xls');
+    } catch (error: any) {
+      createMessage.error(await resolveDownloadErrorMessage(error, '下载转换基站模版失败'));
+    } finally {
+      templateLoading.value = false;
+    }
   };
-
   const handleSearch = async () => {
     let lac = '';
     let ci = '';
@@ -312,40 +272,34 @@
     mapPoints.value = [];
   };
 
-  const doConvertFile = async (fileToken: string) => {
-    await runWithQueryLoading(async () => {
-      const convertResult = await convertBaseStationData(fileToken);
-      const convertedPath = convertResult;
-      if (!convertedPath) {
-        createMessage.warning('转换完成,但未获取到有效路径');
-        return;
-      }
+  /** Web 化:上传基站 xls → 后端转换 → 转换结果以附件流返回,浏览器直接另存 */
+  const handleConvertFileChange = async (event: Event) => {
+    const input = event.target as HTMLInputElement;
+    const file = input.files?.[0] || null;
+    input.value = '';
+    if (!file) return;
 
-      createConfirm({
-        title: '转换完成',
-        content: `基站转换完成,路径为:<br/>${convertedPath}<br/><br/>点击确定后将打开所在文件夹。`,
-        okText: '打开文件夹',
-        cancelText: '关闭',
-        iconType: 'success',
-        async onOk() {
-          if (!ipcRenderer?.invoke) return Promise.resolve();
-          await ipcRenderer.invoke('controller/os/openDirectory', { id: convertedPath });
-          return Promise.resolve();
-        },
+    convertLoading.value = true;
+    try {
+      const response = await uploadBaseStationConvert(file, (percent) => {
+        convertLoading.value = percent < 100;
       });
-    });
-  };
-
-  const handleConvertFile = async () => {
-    if (!ipcRenderer?.invoke) {
-      createMessage.warning('当前不在 Electron 环境');
-      return;
+      const blob = response?.data;
+      if (!(blob instanceof Blob)) {
+        throw new Error('转换结果下载失败');
+      }
+      if (blob.type?.includes('json')) {
+        // 后端以 JSON 报错(如文件格式问题)
+        const message = String(JSON.parse(await blob.text())?.message || '') || '基站文件转换失败';
+        throw new Error(message);
+      }
+      downloadByData(blob, '基站转换结果' + Date.now() + '.xlsx');
+      createMessage.success('基站转换完成,文件已下载');
+    } catch (error: any) {
+      createMessage.error(await resolveDownloadErrorMessage(error, '批量转换基站失败'));
+    } finally {
+      convertLoading.value = false;
     }
-
-    const filePath: string = await ipcRenderer.invoke('controller/os/selectXlsFile');
-    if (!filePath) return;
-
-    await doConvertFile(filePath);
   };
 </script>
 

+ 22 - 20
ai-frontend/src/trans/views/behaviorSpacetime/index.vue

@@ -316,9 +316,11 @@
   } from '@/otg/utils/timeSeriesJump';
   import { getPersons } from '@/person/api/personApi';
   import {
-    ElectronPmtilesSource,
+    HttpPmtilesSource,
     getOfflineMapDir,
-    getOfflineMapFilePath,
+    getOfflineMapPmtilesUrl,
+    getOfflineMapStyleUrl,
+    resolveOfflinePmtilesUrls,
     OFFLINE_MAP_DIR_CHANGED_EVENT,
     toLocalMapUrl,
   } from '@/core/utils/map/offlineMap';
@@ -2419,10 +2421,10 @@
     pmtilesRegistered = true;
   };
   const ensureOfflinePmtilesArchive = () => {
-    const filePath = getOfflineMapFilePath('china.pmtiles');
-    if (!pmtilesProtocol || !filePath) return;
-    if (pmtilesProtocol.get(filePath)) return;
-    pmtilesProtocol.add(new PMTiles(new ElectronPmtilesSource(filePath) as any));
+    if (!pmtilesProtocol) return;
+    resolveOfflinePmtilesUrls().forEach((url) => {
+      if (!pmtilesProtocol?.get(url)) pmtilesProtocol?.add(new PMTiles(new HttpPmtilesSource(url) as any));
+    });
   };
   const getFallbackStyle = () => ({
     version: 8,
@@ -2431,15 +2433,15 @@
   });
   const buildExternalMapStyle = () => {
     const offlineMapDir = getOfflineMapDir();
-    const pmtilesFilePath = getOfflineMapFilePath('china.pmtiles');
-    if (!offlineMapDir || !pmtilesFilePath) return null;
+    const pmtilesUrl = getOfflineMapDir() ? getOfflineMapPmtilesUrl() : '';
+    if (!offlineMapDir || !pmtilesUrl) return null;
     return {
       version: 8,
       name: 'behavior-spacetime-external-map',
       sources: {
         'behavior-basemap': {
           type: 'vector',
-          url: `${PMTILES_PROTOCOL}${pmtilesFilePath}`,
+          url: `${PMTILES_PROTOCOL}${pmtilesUrl}`,
         },
       },
       layers: [
@@ -2517,13 +2519,13 @@
       ],
     };
   };
-  const getOfflineMapStylePath = () => getOfflineMapFilePath('behavior-spacetime-style.json');
+  /** 读取服务端配置目录里的自定义样式(Web:走后端 /sys/map/style,替代原 Electron ipc 读文件) */
   const readOfflineMapStyle = async () => {
-    const ipcRenderer = (window as any)?.electron?.ipcRenderer;
-    const filePath = getOfflineMapStylePath();
-    if (!ipcRenderer?.invoke || !filePath) return '';
+    if (!getOfflineMapDir()) return '';
     try {
-      return (await ipcRenderer.invoke('controller/os/readTextFile', { filePath, encoding: 'utf8' })) || '';
+      const response = await fetch(getOfflineMapStyleUrl(), { cache: 'no-store' });
+      if (!response.ok) return '';
+      return await response.text();
     } catch {
       return '';
     }
@@ -2563,15 +2565,15 @@
     const custom = (window as BehaviorSpacetimeWindow).__BEHAVIOR_SPACETIME_STYLE__ || STYLE_PATH;
     try {
       const offlineMapDir = getOfflineMapDir();
-      const offlinePmtilesFilePath = getOfflineMapFilePath('china.pmtiles');
-      const offlineStylePath = getOfflineMapStylePath();
-      if (offlineMapDir && offlinePmtilesFilePath && offlineStylePath) {
+      const offlinePmtilesUrl = getOfflineMapDir() ? getOfflineMapPmtilesUrl() : '';
+      const offlineStyleUrl = getOfflineMapStyleUrl();
+      if (offlineMapDir && offlinePmtilesUrl && offlineStyleUrl) {
         const styleText = await readOfflineMapStyle();
         if (styleText) {
           const style = JSON.parse(styleText);
           mapMode.value = 'template';
           errorMsg.value = '';
-          return normalizePmtilesSources(style as Record<string, any>, offlineStylePath, offlinePmtilesFilePath);
+          return normalizePmtilesSources(style as Record<string, any>, offlineStyleUrl, offlinePmtilesUrl);
         }
       }
       const externalStyle = buildExternalMapStyle();
@@ -2583,7 +2585,7 @@
       if (custom && typeof custom === 'object') {
         mapMode.value = 'template';
         errorMsg.value = '';
-        return normalizePmtilesSources(custom, window.location.href, offlinePmtilesFilePath || undefined);
+        return normalizePmtilesSources(custom, window.location.href, offlinePmtilesUrl || undefined);
       }
       const styleUrl = resolveStyleAssetUrl(String(custom), window.location.href);
       const response = await fetch(styleUrl, { cache: 'no-store' });
@@ -2594,7 +2596,7 @@
       return normalizePmtilesSources(
         style as Record<string, any>,
         response.url || styleUrl,
-        offlinePmtilesFilePath || undefined,
+        offlinePmtilesUrl || undefined,
       );
     } catch (error) {
       errorMsg.value = error instanceof Error ? error.message : 'style error';

+ 25 - 0
ai-server/src/main/java/com/zsjz/ai/module/graph/controller/GraphController.java

@@ -13,6 +13,9 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 
@@ -103,4 +106,26 @@ public class GraphController {
         graphService.deleteGraphHis(id);
         return Result.succeed();
     }
+
+    /**
+     * 读取关系图历史快照内容(Web 化:按历史ID读取服务端文件,不再由 Electron 读本机文件)
+     *
+     * @param id 图谱历史记录ID
+     */
+    @GetMapping("/history/{id}/content")
+    public Result<String> historyContent(@PathVariable Long id) {
+        return Result.succeed(graphService.readGraphHisContent(id));
+    }
+
+    /**
+     * 保存关系图历史快照内容(Web 化:按历史ID写入服务端文件,不再由 Electron 写本机文件)
+     *
+     * @param id      图谱历史记录ID
+     * @param content 图谱快照 JSON 内容
+     */
+    @PostMapping("/history/{id}/content")
+    public Result<Void> saveHistoryContent(@PathVariable Long id, @RequestBody String content) {
+        graphService.writeGraphHisContent(id, content);
+        return Result.succeed();
+    }
 }

+ 50 - 0
ai-server/src/main/java/com/zsjz/ai/module/graph/service/GraphService.java

@@ -32,6 +32,9 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
 import java.time.LocalDate;
 import java.util.List;
 import java.util.Map;
@@ -639,4 +642,51 @@ public class GraphService {
             file.delete();
         }
     }
+
+    /**
+     * 读取关系图历史快照内容(Web 化:前端只传历史ID,文件路径由服务端查库得到)。
+     */
+    public String readGraphHisContent(Long id) {
+        try {
+            return Files.readString(resolveGraphHisFile(id));
+        } catch (IOException e) {
+            throw ServerException.spe("关系图历史文件不存在或已被清理!");
+        }
+    }
+
+    /**
+     * 保存关系图历史快照内容(Web 化:替代原 Electron ipc 写本机文件)。
+     */
+    public void writeGraphHisContent(Long id, String content) {
+        if (content == null) {
+            throw ServerException.spe("关系图内容不能为空!");
+        }
+        Path file = resolveGraphHisFile(id);
+        try {
+            Files.createDirectories(file.getParent());
+            Files.writeString(file, content);
+        } catch (IOException e) {
+            throw ServerException.spe("保存关系图历史失败!");
+        }
+    }
+
+    /**
+     * 校验并解析关系图历史文件路径:必须来自 {@code GRAPH_HIS_PATH} 目录内的 .json 文件,
+     * 避免退化成任意文件读写接口。
+     */
+    private Path resolveGraphHisFile(Long id) {
+        if (id == null) {
+            throw ServerException.spe("缺少关系图历史ID!");
+        }
+        GraphHis graphHis = graphHisMapper.selectById(id);
+        if (graphHis == null || StrUtil.isBlank(graphHis.getPath())) {
+            throw ServerException.spe("关系图历史不存在!");
+        }
+        Path file = Path.of(graphHis.getPath()).toAbsolutePath().normalize();
+        Path root = PathConst.GRAPH_HIS_PATH.toAbsolutePath().normalize();
+        if (!file.startsWith(root) || !file.toString().toLowerCase().endsWith(".json")) {
+            throw ServerException.spe("非法的关系图历史文件路径!");
+        }
+        return file;
+    }
 }

+ 44 - 12
ai-server/src/main/java/com/zsjz/ai/module/plat/controller/SystemController.java

@@ -8,10 +8,16 @@ import com.zsjz.ai.module.plat.service.SystemService;
 import org.springframework.beans.factory.annotation.Autowired;
 
 import org.springframework.core.io.Resource;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.MediaType;
 import org.springframework.http.ResponseEntity;
 import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestHeader;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestPart;
 import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
 
 /**
  * 系统控制器
@@ -23,8 +29,9 @@ import org.springframework.web.bind.annotation.RestController;
  * 最终一律 404;而前端 `main.ts` 期望 `Result` 包装(`res?.code === 200`),
  * 会导致启动健康检查空转 2 分钟并总是跳转到授权页。
  *
- * <p>例外:{@code /sys/downloadFile} 是**文件下载**接口,只接受 {@code file_info.id},
- * 刻意不返回 {@code Result},响应体是文件流(前端按 blob 读取)。
+ * <p>例外(刻意不返回 {@code Result},响应体是文件内容本身):
+ * {@code /sys/downloadFile}(只接受 {@code file_info.id})、
+ * {@code /sys/map/pmtiles} 与 {@code /sys/map/style}(离线地图瓦片/样式,支持 HTTP Range)。
  */
 @RestController
 @RequestMapping("/sys")
@@ -77,11 +84,13 @@ public class SystemController {
      * 无外网授权激活(离线授权)
      * 通过上传授权文件完成系统激活
      *
-     * @param license 授权文件路径
+     * <p>Web 化改造:接收浏览器上传的 {@code .xlts} 授权文件,不再由前端传服务端文件路径。
+     *
+     * @param licenseFile 上传的授权文件(.xlts)
      */
-    @GetMapping("/noNet")
-    public Result<Void> noNet(String license) {
-        systemService.noNet(license);
+    @PostMapping(value = "/noNet", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
+    public Result<Void> noNet(@RequestPart("file") MultipartFile licenseFile) {
+        systemService.noNet(licenseFile);
         return Result.succeed();
     }
 
@@ -96,14 +105,16 @@ public class SystemController {
     }
 
     /**
-     * 系统版本升级
-     * 解压升级包并执行数据库升级脚本
+     * 上传升级包并执行升级
+     *
+     * <p>Web 化改造:接收浏览器上传的 zip 升级包(不再由前端传服务端文件路径)。
+     * 版本校验 → 解压 → 覆盖数据库 → 执行升级 SQL 的流程在 service 内完成,耗时较长。
      *
-     * @param path 升级包文件路径
+     * @param file 升级包(zip)
      */
-    @GetMapping("/upgrade")
-    public Result<Void> upgrade(String path) {
-        systemService.upgrade(path);
+    @PostMapping(value = "/uploadUpgrade", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
+    public Result<Void> uploadUpgrade(@RequestPart("file") MultipartFile file) {
+        systemService.uploadUpgrade(file);
         return Result.succeed();
     }
 
@@ -121,6 +132,27 @@ public class SystemController {
         return systemService.downloadFile(fid);
     }
 
+    /**
+     * 离线地图瓦片(PMTiles):从系统配置的离线地图目录按 HTTP Range 返回,供浏览器地图组件按块取瓦片。
+     *
+     * <p>Web 化改造:替代原 Electron 通过 ipc 读取本机瓦片文件的方式。不返回 {@code Result},响应体是文件内容。
+     *
+     * @param range 浏览器地图组件发来的 {@code Range} 头(可为空)
+     */
+    @GetMapping("/map/pmtiles")
+    public ResponseEntity<?> mapPmtiles(@RequestHeader(value = HttpHeaders.RANGE, required = false) String range) {
+        return systemService.mapPmtiles(range);
+    }
+
+    /**
+     * 离线地图自定义样式 JSON(可选:配置目录里的 behavior-spacetime-style.json)。
+     * 没有配置时返回 404,前端自动回退到内置样式。
+     */
+    @GetMapping("/map/style")
+    public ResponseEntity<?> mapStyle() {
+        return systemService.mapStyle();
+    }
+
     /**
      * 检查系统授权状态
      * 验证系统是否已正确授权

+ 27 - 8
ai-server/src/main/java/com/zsjz/ai/module/plat/controller/TowerController.java

@@ -4,12 +4,23 @@ import com.zsjz.ai.module.plat.service.TowerService;
 import com.zsjz.ai.common.config.Result;
 
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.core.io.Resource;
+import org.springframework.http.ResponseEntity;
 import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestPart;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
 
 import java.util.List;
 
+/**
+ * 基站查询与基站文件转换
+ *
+ * <p>注意:{@code /covFile}(上传 xls 并转换)与 {@code /template}(下载转换模板)是**文件接口**,
+ * 刻意不返回 {@code Result} 包装(前者响应体是转换后的 xlsx 文件流,后者是模板文件流)。
+ */
 @RestController
 @RequestMapping("/tower")
 public class TowerController {
@@ -22,14 +33,22 @@ public class TowerController {
         return Result.succeed(towerService.qry(mnc, lac, ci));
     }
 
-    @GetMapping("/covFile")
-    public Result<String> covFile(String file){
-        return Result.succeed(towerService.covFile(file));
+    /**
+     * 上传基站 xls 并转换,转换结果以附件流返回(Web 化:浏览器直接另存,
+     * 替代原「前端传服务端路径转换 + Electron 打开文件夹」的方式)。
+     *
+     * @param file 基站数据文件(xls/xlsx,按模板填写)
+     */
+    @PostMapping(value = "/covFile", consumes = org.springframework.http.MediaType.MULTIPART_FORM_DATA_VALUE)
+    public ResponseEntity<Resource> covFile(@org.springframework.web.bind.annotation.RequestPart("file") org.springframework.web.multipart.MultipartFile file) {
+        return towerService.convertUpload(file);
     }
 
-    @GetMapping("/tmpFile")
-    public Result<String> tmpFile(){
-       return Result.succeed(towerService.tmpFile());
+    /**
+     * 下载基站转换模板(Web 化:替代原「返回模板路径 + Electron 打开文件夹」)。
+     */
+    @GetMapping("/template")
+    public ResponseEntity<Resource> template() {
+        return towerService.downloadTemplate();
     }
-
 }

+ 152 - 10
ai-server/src/main/java/com/zsjz/ai/module/plat/service/SystemService.java

@@ -27,17 +27,21 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.core.io.FileSystemResource;
 import org.springframework.core.io.Resource;
+import org.springframework.core.io.support.ResourceRegion;
 import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.http.CacheControl;
 import org.springframework.http.ContentDisposition;
 import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpRange;
+import org.springframework.http.HttpStatus;
 import org.springframework.http.MediaType;
 import org.springframework.http.ResponseEntity;
 import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
 
 
-import java.io.File;
 import java.io.IOException;
+import java.io.InputStream;
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.nio.file.Path;
@@ -48,6 +52,7 @@ import java.sql.Statement;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.temporal.ChronoUnit;
+import java.util.List;
 import java.util.Locale;
 import java.util.Map;
 import java.util.Set;
@@ -130,20 +135,30 @@ public class SystemService extends ServiceImpl<SystemInfoMapper, SystemInfo> {
      * @param license 授权文件路径
      */
 
-    public void noNet(String license) {
-        Assert.isTrue(StrUtil.isNotEmpty(license), () -> ServerException.spe("请选择授权文件!"));
-        File file = new File(license);
-        Assert.isTrue(file.exists(), () -> ServerException.spe("授权文件不存在!"));
-        String fileName = file.getName();
-        log.debug("fileName:{}", fileName);
-        if (StrUtil.isBlank(fileName)) {
+    /**
+     * 无外网授权激活(离线授权)
+     *
+     * <p>Web 化改造:直接接收浏览器上传的授权文件(原实现由前端传服务端文件路径)。
+     *
+     * @param licenseFile 上传的授权文件(.xlts)
+     */
+    public void noNet(MultipartFile licenseFile) {
+        Assert.isTrue(licenseFile != null && !licenseFile.isEmpty(), () -> ServerException.spe("请选择授权文件!"));
+        String fileName = String.valueOf(licenseFile.getOriginalFilename());
+        if (StrUtil.isBlank(fileName) || "null".equals(fileName)) {
             throw new ServerException(LicenseErrorEnum.FILE_UPLOAD_FAIL.getMessage());
         }
         if (!fileName.toLowerCase().endsWith(".xlts")) {
             throw new ServerException(LicenseErrorEnum.FILE_UPLOAD_FAIL.getMessage());
         }
-        //文件写入
-        FileUtil.copyFile(file, PathConst.LICENSE_PATH_FILE.toFile(), StandardCopyOption.REPLACE_EXISTING);
+        //文件写入(覆盖 QingJian/license/license.xlts)
+        try (InputStream in = licenseFile.getInputStream()) {
+            Files.createDirectories(PathConst.LICENSE_PATH);
+            Files.copy(in, PathConst.LICENSE_PATH_FILE, StandardCopyOption.REPLACE_EXISTING);
+        } catch (IOException e) {
+            log.error("保存授权文件失败", e);
+            throw new ServerException(LicenseErrorEnum.FILE_UPLOAD_FAIL.getMessage());
+        }
         if (!LicenseUtil.isWin()) {
             chmodLicenseFile();
         }
@@ -186,6 +201,39 @@ public class SystemService extends ServiceImpl<SystemInfoMapper, SystemInfo> {
         return Json.toCls(exec.msg(), AuthInfo.class);
     }
 
+    /**
+     * 上传升级包并执行升级。
+     *
+     * <p>Web 化改造:接收浏览器上传的 zip 升级包,落盘到仓库根目录的临时文件后,
+     * 复用 {@link #upgrade(String)} 的原有逻辑(版本校验 → 解压 → 覆盖 db → 执行升级 SQL),
+     * 无论成功失败都会清理临时包。
+     *
+     * @param file 升级包(zip)
+     */
+    public void uploadUpgrade(MultipartFile file) {
+        Assert.isTrue(file != null && !file.isEmpty(), () -> ServerException.spe("请选择升级文件!"));
+        String fileName = String.valueOf(file.getOriginalFilename());
+        if (StrUtil.isBlank(fileName) || !fileName.toLowerCase().endsWith(".zip")) {
+            throw ServerException.spe("升级包必须是 zip 文件!");
+        }
+        Path tempZip = PathConst.ROOT_PATH.resolve("upgrade-package.zip").toAbsolutePath().normalize();
+        try {
+            try (InputStream in = file.getInputStream()) {
+                Files.copy(in, tempZip, StandardCopyOption.REPLACE_EXISTING);
+            }
+            upgrade(tempZip.toString());
+        } catch (IOException e) {
+            log.error("保存升级包失败", e);
+            throw ServerException.spe("保存升级包失败!");
+        } finally {
+            try {
+                Files.deleteIfExists(tempZip);
+            } catch (IOException e) {
+                log.warn("清理临时升级包失败: {}", tempZip, e);
+            }
+        }
+    }
+
     /**
      * 系统版本升级
      * 解压升级包并执行数据库升级脚本
@@ -387,6 +435,100 @@ public class SystemService extends ServiceImpl<SystemInfoMapper, SystemInfo> {
         SystemConfManager.INSTANCE.set("mapLocal", path);
     }
 
+    /** 离线地图瓦片文件名(固定放在 mapLocal 配置的目录下) */
+    private static final String MAP_PMTILES_FILE = "china.pmtiles";
+    /** 离线地图样式文件名(可选,放在 mapLocal 配置的目录下;没有则前端用内置样式) */
+    private static final String MAP_STYLE_FILE = "behavior-spacetime-style.json";
+
+    /**
+     * 离线地图瓦片(PMTiles):从 {@code mapLocal} 配置目录读取,支持 HTTP Range。
+     *
+     * <p>Web 端浏览器地图组件按块(Range)读取瓦片,替代原 Electron 的 ipc 文件读取;
+     * 瓦片全部来自服务端配置的目录,调用方无法指定路径。
+     *
+     * @param rangeHeader 请求头 {@code Range},可为空(空则返回整个文件)
+     */
+    public ResponseEntity<?> mapPmtiles(String rangeHeader) {
+        return serveLocalFile(resolveMapFile(MAP_PMTILES_FILE), rangeHeader);
+    }
+
+    /**
+     * 离线地图自定义样式 JSON(配置目录里的可选文件)。
+     */
+    public ResponseEntity<?> mapStyle() {
+        return serveLocalFile(resolveMapFile(MAP_STYLE_FILE), null);
+    }
+
+    /**
+     * 解析离线地图目录下的文件:目录取自系统配置 {@code mapLocal}
+     * (运维可通过 {@code /sys/mapLocal} 或 {@code QingJian/conf/c5e503ad.json} 设置)。
+     *
+     * <p>文件名是固定白名单常量,不接受调用方传入,避免任意文件读取。
+     */
+    private Path resolveMapFile(String fileName) {
+        String dir = getMapLocal();
+        if (StrUtil.isBlank(dir)) {
+            throw new ServerException(404, "未配置离线地图目录");
+        }
+        Path file = Path.of(dir).resolve(fileName).toAbsolutePath().normalize();
+        if (Files.notExists(file) || !Files.isRegularFile(file)) {
+            throw new ServerException(404, "离线地图文件不存在:" + file);
+        }
+        return file;
+    }
+
+    /**
+     * 按 HTTP Range 语义返回本地文件:无 Range 返回 200 全量,单区间返回 206 分片。
+     *
+     * <p>刻意不做 {@code Result} 包装 —— 响应体是文件内容本身。
+     */
+    private ResponseEntity<?> serveLocalFile(Path file, String rangeHeader) {
+        Resource resource = new FileSystemResource(file);
+        long length;
+        try {
+            length = Files.size(file);
+        } catch (IOException e) {
+            throw new ServerException(404, "文件不存在或已被清理");
+        }
+
+        if (StrUtil.isBlank(rangeHeader)) {
+            return ResponseEntity.ok()
+                    .contentType(MediaType.APPLICATION_OCTET_STREAM)
+                    .header(HttpHeaders.ACCEPT_RANGES, "bytes")
+                    .contentLength(length)
+                    .body(resource);
+        }
+
+        List<HttpRange> ranges;
+        try {
+            ranges = HttpRange.parseRanges(rangeHeader);
+        } catch (IllegalArgumentException e) {
+            return rangeNotSatisfiable(length);
+        }
+        if (ranges.size() != 1) {
+            // PMTiles 只发单区间请求;多区间/非法区间一律 416
+            return rangeNotSatisfiable(length);
+        }
+        try {
+            HttpRange range = ranges.get(0);
+            long start = range.getRangeStart(length);
+            long end = range.getRangeEnd(length);
+            ResourceRegion region = new ResourceRegion(resource, start, end - start + 1);
+            return ResponseEntity.status(HttpStatus.PARTIAL_CONTENT)
+                    .contentType(MediaType.APPLICATION_OCTET_STREAM)
+                    .header(HttpHeaders.ACCEPT_RANGES, "bytes")
+                    .body(region);
+        } catch (IllegalArgumentException e) {
+            return rangeNotSatisfiable(length);
+        }
+    }
+
+    private static ResponseEntity<?> rangeNotSatisfiable(long length) {
+        return ResponseEntity.status(HttpStatus.REQUESTED_RANGE_NOT_SATISFIABLE)
+                .header(HttpHeaders.CONTENT_RANGE, "bytes */" + length)
+                .build();
+    }
+
     public String checkUpdate() {
         if (Files.exists(PathConst.ORI_UPGRADE_PATH)) {
             return PathConst.ORI_UPGRADE_PATH.toString();

+ 81 - 8
ai-server/src/main/java/com/zsjz/ai/module/plat/service/TowerService.java

@@ -1,5 +1,7 @@
 package com.zsjz.ai.module.plat.service;
 
+import cn.hutool.core.io.FileUtil;
+import cn.hutool.core.lang.Assert;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.StrUtil;
 import com.zsjz.ai.common.constants.PathConst;
@@ -9,12 +11,22 @@ import com.zsjz.ai.common.utils.TowerUtils;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.io.FileUtils;
 import org.apache.fesod.sheet.FesodSheet;
+import org.springframework.core.io.FileSystemResource;
+import org.springframework.core.io.Resource;
+import org.springframework.http.ContentDisposition;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
 import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
 
 import java.io.IOException;
+import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -64,16 +76,77 @@ public class TowerService {
         return exportPathStr;
     }
 
-    public String tmpFile() {
-        String userDownloadsDir = "AppDirsFactory.getInstance().getUserDownloadsDir(null, null, null)";
-        String fileName = "基站导入模板" + System.currentTimeMillis() + ".xls";
-        Path exportPath = Paths.get(userDownloadsDir, fileName);
+    /**
+     * 上传基站 xls 并转换(Web 化:接收浏览器上传的文件,转换结果以附件流返回给浏览器下载)。
+     *
+     * <p>原实现「返回服务端路径 + Electron 打开文件夹」依赖客户端与服务端同机,纯 Web 下不成立。
+     *
+     * @param file 按模板填写的基站数据文件(xls/xlsx,≤50000 行)
+     * @return 转换结果 xlsx 的附件响应
+     */
+    public ResponseEntity<Resource> convertUpload(MultipartFile file) {
+        Assert.isTrue(file != null && !file.isEmpty(), () -> ServerException.spe("请选择基站文件!"));
+        String originalName = String.valueOf(file.getOriginalFilename());
+        String ext = originalName.toLowerCase().endsWith(".xlsx") ? ".xlsx" : ".xls";
+        if (StrUtil.isBlank(originalName) || !(originalName.toLowerCase().endsWith(".xls") || originalName.toLowerCase().endsWith(".xlsx"))) {
+            throw new ServerException("仅支持 xls、xlsx 文件!");
+        }
+
+        // 落盘到 QingJian/tmp/tower-<ts>/,转换完成后统一清理
+        Path workDir = PathConst.RUN_QINGJIAN_PATH.resolve("tmp").resolve("tower-" + System.currentTimeMillis());
+        Path uploaded = null;
+        Path output = null;
         try {
-            FileUtils.copyFile(PathConst.COV_TMP_PATH.toFile(), exportPath.toFile());
+            Files.createDirectories(workDir);
+            uploaded = workDir.resolve("upload" + ext);
+            try (InputStream in = file.getInputStream()) {
+                Files.copy(in, uploaded, StandardCopyOption.REPLACE_EXISTING);
+            }
+            output = workDir.resolve("基站转换结果" + System.currentTimeMillis() + ".xlsx");
+            TowerListener towerListener = new TowerListener(output.toString());
+            FesodSheet.read(uploaded.toFile(), TowerConvertDTO.class, towerListener)
+                    .sheet()
+                    .headRowNumber(2)
+                    .numRows(50000)
+                    .doRead();
         } catch (IOException e) {
-            log.error("复制基站导入模板文件失败!", e);
-            throw new ServerException("获取基站导入模板文件失败!");
+            log.error("基站文件转换失败", e);
+            throw new ServerException("基站文件转换失败!");
+        } finally {
+            if (uploaded != null) {
+                try {
+                    Files.deleteIfExists(uploaded);
+                } catch (IOException e) {
+                    log.warn("清理上传的临时基站文件失败: {}", uploaded, e);
+                }
+            }
+        }
+
+        if (Files.notExists(output)) {
+            throw new ServerException("基站文件转换失败!");
+        }
+        String fileName = "基站转换结果" + System.currentTimeMillis() + ".xlsx";
+        return ResponseEntity.ok()
+                .contentType(MediaType.parseMediaType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"))
+                .header(HttpHeaders.CONTENT_DISPOSITION,
+                        ContentDisposition.attachment().filename(fileName, StandardCharsets.UTF_8).build().toString())
+                .contentLength(FileUtil.size(output.toFile()))
+                .body(new FileSystemResource(output));
+    }
+
+    /**
+     * 下载基站转换模板(Web 化:以附件流返回,替代原「复制到下载目录 + Electron 打开文件夹」)。
+     */
+    public ResponseEntity<Resource> downloadTemplate() {
+        Path template = PathConst.COV_TMP_PATH;
+        if (Files.notExists(template)) {
+            throw new ServerException("基站导入模板文件不存在!");
         }
-        return exportPath.toAbsolutePath().normalize().toString();
+        return ResponseEntity.ok()
+                .contentType(MediaType.parseMediaType("application/vnd.ms-excel"))
+                .header(HttpHeaders.CONTENT_DISPOSITION,
+                        ContentDisposition.attachment().filename("基站导入模板.xls", StandardCharsets.UTF_8).build().toString())
+                .contentLength(FileUtil.size(template.toFile()))
+                .body(new FileSystemResource(template));
     }
 }

+ 152 - 0
electron-migration-plan.md

@@ -0,0 +1,152 @@
+# Electron 残留 → 纯 Web 迁移方案
+
+> 盘点时间:2026-09-16 · 范围:`ai-frontend/src`(后端 `ai-server` 仅列需要配合的改动)
+> 盘点方式:全仓 `electron|ipcRenderer|isElectron` 命中点逐个读源码确认用途
+> 结论:**共 14 项**,其中 3 项「直接删」、6 项「前端改造即可」、5 项「需后端配合」;4 项存在 Web 天然能力缺失,给了降级方案
+>
+> **进度(2026-09-16 晚)**:第 **3、4、5** 项已完成(详见文末「已实施记录」)。
+
+---
+
+## 已实施记录(2026-09-16)
+
+### 4/5. 两个「选择」功能已删除 ✅
+| 删除对象 | 说明 |
+| --- | --- |
+| `core/layouts/default/setting/components/OfflineMapModal.vue` | 离线地图目录选择弹窗(ipc `selectFolder`) |
+| `core/layouts/default/setting/components/CellLocalModal.vue` | 基站包路径选择弹窗(ipc `selectBinFile` + 读前 16 字节) |
+| `core/utils/caseGlobalConfig.ts` | 仅为把这两条路径通过 Electron ipc 写到本机配置文件,随选择功能一起删除 |
+| `SettingFooter.vue` 两个入口按钮/弹窗/引导事件监听、`components/index.ts` 两个导出 | 一并清理 |
+| `caseConfigGuide.ts` 的 `hydratePersistedCaseGlobalConfig()` 调用与两个弹窗事件常量 | 保留 `initGlobalCaseConfig()`(现在只从后端读配置)与 `OPEN_SETTING_DRAWER_EVENT` |
+
+**删除后路径怎么配(重要)**:两个路径本来就存在**服务端**配置里(`SystemConfManager` → `QingJian/conf/c5e503ad.json` 的 `mapLocal` / `cellLocal` 字段),
+前端只是通过 `/sys/getMaplocal`、`/sys/getCellLocal` 读回来缓存。所以 UI 删掉后有两种设置方式:
+1. 调用接口:`GET /js/a/sys/mapLocal?path=...`、`GET /js/a/sys/cellLocal?path=...`(`/sys/cellLocal` 会校验文件存在且非目录)
+2. 直接编辑 `QingJian/conf/c5e503ad.json`:`{"mapLocal":"E:/map","cellLocal":"E:/cell/xxx.bin"}`(**改完需重启后端**,配置是启动时读入内存的)
+
+### 3. 离线地图瓦片:方案 A 已落地 ✅
+**后端**(`SystemController` + `SystemService`)
+- 新增 `GET /sys/map/pmtiles`:从 `mapLocal` 配置目录读 `china.pmtiles`,**支持 HTTP Range**(无 Range → 200 全量 + `Accept-Ranges: bytes`;单区间 → 206 + `ResourceRegion`;多区间/非法/越界 → 416)
+- 新增 `GET /sys/map/style`:返回配置目录里的自定义样式 `behavior-spacetime-style.json`(没有则 404,前端自动回退内置样式)
+- 两个接口**刻意不返回 `Result`**(响应体是文件内容),文件名是服务端固定白名单常量、不接受调用方传参
+- 逻辑全在 service(`mapPmtiles` / `mapStyle` / `resolveMapFile` / `serveLocalFile`),controller 仅转发
+
+**前端**
+- `core/utils/map/offlineMap.ts`:删除 `ElectronPmtilesSource`(ipc 读本机文件),新增 `HttpPmtilesSource`(`fetch` + `Range` 头取块)、`getOfflineMapPmtilesUrl()`、`getOfflineMapStyleUrl()`、`getBuiltinPmtilesUrl()`、`resolveOfflinePmtilesUrls()`
+- 三个地图组件(`BaseStationQueryMap.vue`、`StationMapModal.vue`、`behaviorSpacetime/index.vue`):
+  `new ElectronPmtilesSource(本地路径)` → `new HttpPmtilesSource(后端 URL)`;自定义样式从 ipc 读文件改为 `fetch /sys/map/style`;未配置服务端目录时自动回退到前端静态资源 `public/resource/map/china.pmtiles`(内置样式本来就指向 `pmtiles://resource/map/china.pmtiles`,现在会把该地址也注册成瓦片源)
+- 因此**两个部署形态都可用**:①瓦片放服务端 `mapLocal` 目录(走后端 Range);②瓦片放前端构建产物 `public/resource/map/`(走静态服务,需该静态服务支持 Range)
+
+**验证**
+- 后端 `mvn -pl ai-server -B compile` → BUILD SUCCESS
+- Range 分支逻辑:用真实 spring-web 6.2.19 跑了 9 个用例(`0-99`/`100-`/`-100`/`999-999` → 206;`0-1,5-6`/`abc`/`2000-3000`/`-0` → 416;无 Range → 200)**全通过**
+- 前端:esbuild 打包真实 `offlineMap.ts` + 起本地 Range 服务,跑 10 项断言(URL 拼装、Range 头、返回字节、空参数不发请求、404 返回空)**全通过**
+- `eslint --max-warnings 0` 0 错误;`vue-tsc` 全仓仍 103(无新增)
+
+---
+
+## 一、总览
+
+| # | 功能 | 现状(Electron 依赖) | 迁移方案 | 后端改动 | 难度 |
+|---|---|---|---|---|---|
+| 1 | 窗口最小化/最大化/关闭 | `window.electron.windowMinimize/Maximize/Close` + `window:maximize-change` 事件 | ✅ **已完成**:4 个组件 + `useElectronWindow` 已删除(本就没有页面挂载它们,纯死代码) | 无 | — |
+| 2 | 版本号展示 | `useElectronWindow().getVersion()` | ✅ **已完成**:AppLogo/ProductInfoModal 改用构建期 `__APP_INFO__.pkg.version`(vite define 已注入) | 无 | — |
+| 3 | 离线地图瓦片读取 | `ElectronPmtilesSource.getBytes()` 走 ipc `readBinaryFileRange` | ✅ **已完成**:后端 `GET /sys/map/pmtiles`(支持 Range)+ 前端 `HttpPmtilesSource`;未配置目录时回退前端静态 `resource/map/china.pmtiles` | 已实现 | — |
+| 4 | 离线地图目录选择 | ipc `controller/os/selectFolder` | ✅ **已删除**功能;路径改由服务端配置(`/sys/mapLocal` 或 `QingJian/conf/c5e503ad.json`) | 已实现 | — |
+| 5 | 基站库(.bin)选择 | ipc `selectBinFile` + 读前 16 字节校验 | ✅ **已删除**功能;路径改由服务端配置(`/sys/cellLocal` 或同一配置文件) | 已实现 | — |
+| 6 | 案件全局配置持久化 | ipc `readCaseGlobalConfig` / `writeCaseGlobalConfig` | 改存后端(按 caseId)——`/sys/getMaplocal`、`/sys/cellLocal` 接口已存在,直接复用;纯本机偏好可退化为 `localStorage` | 复用现有接口 | ★ |
+| 7 | 授权文件选择 | ipc `controller/effect/selectFile` → 传**服务端路径**给 `/sys/noNet` | ✅ **已完成**:`<input type=file accept=".xlts">` + `POST /sys/noNet`(multipart),后端落盘到 LICENSE_PATH 并校验激活 | 已实现 | — |
+| 8 | 升级包选择 | ipc `controller/effect/selectFile` → `/sys/upgrade?path=` | ✅ **已完成**:`<input type=file accept=".zip">` + `POST /sys/uploadUpgrade`(multipart,带进度),后端落盘临时 zip 后复用原 upgrade 流程并清理 | 已实现 | — |
+| 9 | 图谱历史文件读写 | ipc `readTextFile` / `writeTextFile`(路径来自后端 `graph_his`,本质是**服务端文件**) | ✅ **已完成**:新增 `GET/POST /graph/history/{id}/content`(服务端校验路径必须在 GRAPH_HIS_PATH 内),前端按历史ID读写 | 已实现 | — |
+| 10 | 基站 xls 选择 + 打开目录 | ipc `selectXlsFile` / `openDirectory` | ✅ **已完成**:`POST /tower/covFile`(multipart 上传,结果以附件流返回浏览器下载);模板改为 `GET /tower/template` 附件下载;"打开文件夹"交互删除 | 已实现 | — |
+| 11 | 头像本地路径 | `window.electron.getPathForFile(file)` 存本机路径;`PersonAvatar` 再用 ipc 读图 | 改为**上传图片**→后端存盘并返回 URL(可复用 `LocalFileStorageUtil` + `base-url` 配置),前端 `<img :src>` 直显;预览用 `URL.createObjectURL(file)` | 需要(新增图片上传接口) | ★★★ |
+| 12 | `file:` 协议兜底 baseURL | `governApi.ts` 的 `getPackagedFallbackOrigin()`(`location.protocol === 'file:'` → `http://localhost:8980`) | ✅ **已完成**:常量与函数已删,host 兜底链只剩同源 | 无 | — |
+| 13 | `window.electron` 类型声明 | `types/global.d.ts` | 第 1~12 项做完后删除 | 无 | ★ |
+| 14 | `preFile`(本地路径数组)注释 | `governApi.ts` 注释「Electron 本地路径方式,保留兼容」 | 代码实际只被 importList 用**服务端路径**调用(重新清洗),逻辑本身没问题,仅更新注释 | 无 | ★ |
+
+---
+
+## 二、重点项的落地细节
+
+### 3. 离线地图瓦片(最关键,决定地图能不能用)
+
+现状:`ElectronPmtilesSource.getBytes(offset, length)` 用 ipc 读本机文件片段,PMTiles 库靠它按需取瓦片。
+三个地图组件构造 Source:`BaseStationQueryMap.vue:107`、`behaviorSpacetime/index.vue:2425`、`StationMapModal.vue:154`。
+
+```ts
+// 方案 A(推荐,瓦片放服务器):后端加一个支持 Range 的接口
+//   GET /sys/map/pmtiles  → 从 mapLocal 配置的目录流式返回 china.pmtiles
+//   Spring 的 ResourceHttpRequestHandler 原生支持 Range(206),无需手写
+export class HttpPmtilesSource {
+  constructor(private url: string) {}
+  getKey() { return this.url; }
+  async getBytes(offset: number, length: number) {
+    const res = await fetch(this.url, { headers: { Range: `bytes=${offset}-${offset + length - 1}` } });
+    return { data: await res.arrayBuffer() };
+  }
+}
+
+// 方案 B(瓦片在用户本机):<input type=file accept=".pmtiles"> 选一次,之后纯前端切片
+export class FilePmtilesSource {
+  constructor(private file: File) {}
+  getKey() { return `${this.file.name}:${this.file.size}`; }
+  async getBytes(offset: number, length: number) {
+    return { data: await this.file.slice(offset, offset + length).arrayBuffer() };
+  }
+}
+```
+两个类都满足 PMTiles 的 `Source` 接口,替换 `new ElectronPmtilesSource(path)` 即可;**方案 B 完全不需要后端**。
+
+### 4/5/8. 「选择服务端文件/目录」的统一解法
+
+这三处的路径最终都存到**服务端**(`/sys/mapLocal`、`/sys/cellLocal`、`/sys/upgrade`),Electron 里只是用对话框拿到一个字符串。Web 里最贴近的做法是**后端提供受限的目录浏览**:
+
+- `GET /sys/browse?path=&root=` → 返回该目录下的子目录/文件(**必须白名单根目录 + normalize 防 `../` 穿越**,参考 `AgentPythonFileController.assertSafeSegment` 的写法)
+- 前端把「选择文件夹」弹窗换成「服务端目录浏览弹窗」,点选结果仍是路径字符串 → 后续链路一行不用改
+- 若不想做浏览弹窗:退化为「文本框输入路径 + 保存时后端校验(存在/后缀/可读)」,弹一条明确的错误提示
+
+### 7. 授权文件(离线授权)
+
+- 前端:`<input type="file" accept=".xlts">` → `const text = await file.text()`
+- 后端:`/sys/noNet` 从「收 license 路径」改为「收文本内容或 multipart」,服务端自行写入 `PathConst.LICENSE_PATH` 再走原有校验
+- 注意:授权与机器码绑定,**服务端写文件的路径必须固定**,不要让前端指定
+
+### 11. 头像(唯一涉及存量数据的一项)
+
+- 新数据:上传接口(`POST /case/avatar` 之类)→ 后端用 `LocalFileStorageUtil` 存盘 → 返回可访问 URL(`file-url.base-url` 已配置为 `http://localhost:8980/js/a`)→ 库表里存 URL
+- 历史数据:库里存的是 `file:///C:/...png` 这种本机绝对路径,**浏览器读不到** → 需要一次性迁移脚本(把这些行标记为无头像,显示占位图),或让用户重新上传
+- `PersonAvatar.loadLocalImage()` 里的 ipc 读图整段删除,改为直接绑定 URL
+
+---
+
+## 三、建议实施顺序
+
+| 批次 | 内容 | 说明 |
+|---|---|---|
+| P0(无依赖,随时可做) | 1、2、6、12、14 | 纯删除/替换,风险最低,先把「Electron 存在感」降下来 |
+| P1(前端改造即可) | 3-方案B、7、9、10 | 3B/9/10 体验与 Electron 版基本等价;7 需后端小改(收内容) |
+| P2(需后端补接口) | **3-方案A ✅、4 ✅、5 ✅**、8 | 3/4/5 已完成(见文末已实施记录);8 仍在待办 |
+| P3(涉及存量数据) | 11 | 需要迁移策略与用户沟通 |
+| 收尾 | 13(删类型声明)+ 全仓 grep 归零 | 验收:`grep -ri "electron\|ipcRenderer" ai-frontend/src` 为 0 |
+
+---
+
+## 四、Web 天然做不到、必须换交互的 4 件事
+
+1. **打开/定位本机目录**(基站模块"打开文件夹"、图谱目录)→ 改为页内文件列表 + 下载,或提示路径让用户自行打开
+2. **读取本机任意路径的文件**(地图瓦片、基站包、头像)→ 上传,或服务端侧选择
+3. **窗口控制**(最小化/最大化/关闭)→ 删除;可保留"全屏"按钮
+4. **静默读写本机文件**(案件全局配置、图谱历史)→ 挪到服务端接口
+
+---
+
+## 五、验收清单(每项做完怎么算过)
+
+- [ ] 全仓代码里不再有 Electron 依赖:`grep -rn "electron\|ipcRenderer\|isElectron" ai-frontend/src` **只剩注释里的历史说明**(无任何 `window.electron` / ipc 调用)
+- [ ] `types/global.d.ts` 里 `window.electron` 声明已删
+- [x] 地图:瓦片走后端 Range 接口能出图(Range 分支逻辑已单测通过;浏览器实测待做)
+- [x] 地图目录/基站包:不再有 UI 选择入口,路径由服务端配置提供
+- [ ] 离线授权:用真实 `.xlts` 文件走通一次授权成功
+- [ ] 图谱历史:保存后刷新页面能重新读取到同样的图
+- [ ] 头像:上传后立刻显示;库里历史 `file://` 数据不报错(显示占位图)
+- [x] `eslint`(改动文件)0 错误;`vue-tsc` 不新增错误