Files
track-LICA/frontend/vite.config.ts
duxingchen 347b7b6a68 feat: LICA 部门独立实例 — 组织隔离与端口/标识改造
派生自 IRIS 实例的 feature/ai-audit-update @ 192c8ee,在同一台机器上独立运行。

隔离机制(开关集中在 app/core/config.py 的 ORG_DEPARTMENT / MATERIAL_CATEGORY_PREFIX):
- 登录:sys_user 查询增加 department 条件,非本部门账号一律 401
- 人员列表:服务端钉死部门、忽略客户端传参;删除「异常退回全表」的降级分支
- 物料:groups 与 items 都增加 category LIKE 'LICA/%' 前缀过滤
- 人员操作统计:把硬编码的 department='IRIS' 改为配置项

物料为什么用前缀而不是 LIKE '%LICA%':
MOM 里存在 171 条 IRIS/成品/LICA/...(无人机/野外便携/高塔监测等),
模糊匹配会把这些 IRIS 物料漏给 LICA。实测前缀匹配命中 795 条 / 5 个分组。

部署隔离:
- 端口 8030/8031/8032,容器名 lica_*,卷 lica_pgdata(与 IRIS 完全独立)
- 服务名改为 lica_backend,避免在 projects_default 网络上与 IRIS 的 backend
  重名 —— 否则将来任何一方写 http://backend:8000 会随机打到另一个部门
- SECRET_KEY 重新生成:实测两边 token 互不通用(双向 401)

客户端标识(不改会导致两个部门的客户端互相覆盖):
- Tauri identifier 改 com.lica.production(否则桌面端互相覆盖安装,且共用
  WebView 数据目录会让 track_admin_token 串号)
- uni-app appid 改 __UNI__D2F4A19(否则同机 APK 互相覆盖、wgt 热更新串号)
- uni-app 地址端口 8011 → 8031(收敛在 utils/config.js 单一来源)
- sync-watch.sh 的 DST 指向 LICA 专属 HBuilderX 目录(否则会把源码灌进 IRIS 工程)

排除项:未复制 deploy.sh / deploy_full.sh / docker-compose.prod.yml ——
它们写死了 IRIS 的生产服务器,误跑会覆盖线上系统。
2026-09-21 16:10:52 +08:00

48 lines
1.5 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import tailwindcss from "@tailwindcss/vite";
import basicSsl from "@vitejs/plugin-basic-ssl";
// https://vite.dev/config/
export default defineConfig({
// 🚀 basicSsl 仅 dev本地 HMR https需要生产 build 跳过,
// 避免服务器容器低熵环境下生成自签名证书导致 vite build 卡住
plugins: [
react(),
tailwindcss(),
...(process.env.NODE_ENV !== "production" ? [basicSsl()] : []),
],
// 🚀 构建优化:将第三方巨头独立分包,利用浏览器缓存
build: {
rollupOptions: {
output: {
manualChunks(id: string) {
if (id.includes("node_modules/react-dom") || id.includes("node_modules/react/") || id.includes("node_modules/scheduler")) return "vendor-react";
if (id.includes("node_modules/react-router")) return "vendor-react";
if (id.includes("node_modules/antd") || id.includes("node_modules/@ant-design")) return "vendor-antd";
if (id.includes("node_modules/html5-qrcode")) return "vendor-qrcode";
},
},
},
},
clearScreen: false,
server: {
host: "0.0.0.0",
port: 1420,
strictPort: true,
// Docker on Windows/WSL 必须用 polling 才能检测到文件变化
watch: {
usePolling: true,
ignored: ["**/src-tauri/**"],
},
proxy: {
"/api": {
target: "http://lica_backend:8000", // Docker 内部用服务名LICA 实例)
changeOrigin: true,
},
},
},
});