Files
apes-Authon-Web/docs/剥离历史与说明.md

12 KiB
Raw Permalink Blame History

apes-Authon-Web 剥离历史与说明

本文档记录从 saas-web 单体前端剥离纯净账权页面的执行过程、变更明细和框架修改说明。

  • 源仓库: saas-web(单体前端,含 120+ 页面)
  • 目标仓库: apes-Authon-Web(纯净账权前端,40 页面)
  • 剥离时间: 2026-08-09
  • 提交: 8ebd1ca — 176 files changed, +222/-60093

一、剥离概览

分类 数量 说明
账权页面保留 24 login、register、user、permission、customer、app
系统配置保留 9 organization、operationlog、quota、packagePlan
AI/LLM 页面保留 11 llmModel、llmAgent、aiHelper、ai 工具管理
业务页面删除 ~82 fei、trace、weight、tracing、irrigation 等
框架文件修改 8 router、main.js、request.js、store 等
代码变更量 +222 / -60093 净减约 6 万行业务代码

二、保留清单

2.1 页面 (views/)

目录 文件 功能
login/ index.vue 登录页(短信验证码 + 密码 + SSO)
register/ index.vue 注册页
user/ list.vue, editProfile.vue, info.vue, pwd.vue, sso.vue 用户管理(5 个页面)
permission/ menuList.vue, permissionList.vue, roleList.vue 权限管理(3 个页面)
customer/ index.vue, detail.vue, editCustomer.vue, employee.vue, user.vue, myCustomer.vue, packages.vue, packageOverview.vue, quotaChangeLog.vue, uiConfig.vue, accessToken.vue, extendApplyList.vue 客户管理(12 个页面)
app/ appList.vue, appDetail.vue 应用管理
system/ organization/, operationlog/, quota/, packagePlan/, llmModel/, llmAgent/, aiHelper/ 系统配置 + AI/LLM 配置(8 个页面)
ai/ tool.vue, toolEdit.vue, skill.vue, toolLog.vue, callLog.vue, conversationHistory.vue, chat.vue AI 工具管理(7 个页面)
home/ index.vue 首页看板
base/ imageUpload.vue 图片上传
404.vue 404 错误页

2.2 API 文件 (api/) — 19 个

文件 功能
user.js 登录/注册/用户管理/获取当前用户
permissionApi.js 菜单/权限/角色 CRUD
menuApi.js 动态路由构建(require.context
appApi.js 应用管理 CRUD
customerApi.js 客户管理 CRUD
customerPackageApi.js 客户套餐管理
accessTokenApi.js AccessToken 管理
organizationApi.js 组织架构管理
quotaApi.js 配额管理
packagePlanApi.js 套餐方案管理
baseApi.js 基础接口(文件上传等)
llmModelApi.js LLM 模型配置
llmAgentApi.js LLM Agent 管理
llmAgentSkillApi.js LLM Agent 技能管理
llmAgentToolApi.js LLM Agent 工具管理
llmToolApi.js LLM 工具管理
llmToolLogApi.js LLM 工具日志
llmConversationApi.js LLM 对话管理
aiSkill.js AI 技能管理

2.3 组件 (components/) — 6 个

文件 功能 备注
breadcrumb.vue 面包屑导航 原样保留
tagView.vue 标签页缓存 原样保留
pageBox.vue 页面容器 原样保留
iframeView.vue 通用 iframe 组件 重写(见下文)
MarkdownContent.vue Markdown 渲染 新建(见下文)
ai/ai_helper.vue AI 助手浮窗 原样保留

2.4 工具函数 (utils/) — 10 个

文件 功能 备注
request.js Axios 封装 修改(见下文)
index.js 通用工具函数 原样保留
validate.js 校验工具 原样保留
msgUtil.js 消息提示 原样保留
public.js 公共方法 原样保留
constUtil.js 常量 原样保留
envUtil.js 环境变量 原样保留
autoRefresh.js 自动刷新 原样保留
uiSizeUtil.js UI 尺寸 原样保留
get-page-title.js 页面标题 原样保留

三、删除清单

3.1 页面删除

目录 文件数 业务域
fei/ 22 智慧农业大屏/可视化
trace/ 21 溯源管理
weight/ 13 自助过磅系统
tracing/ 6 溯源追踪/路线
irrigation/ 2 灌溉管理
brain/ 3 AI 大脑
certify/ 5 认证管理
certifyAgreement/ 1 认证协议
payment/ 1 支付
park/ 2 园区管理
waterFertilizer/ 2 水肥一体化
fertigationDevice/ 2 施肥设备
extLink/ 1 外部链接
preference/ 1 偏好设置
agreement/ 1 协议管理
web/ 1 Web iframe
tracking/ 1 追踪
huoban/ 1 伙伴云(Phase 5C 代办)
其他 ~3 PAGECODE.md 等

3.2 API 删除

文件/目录 业务域
fei/ 目录 智慧农业
trace/, traceabilityApi.js, trackingConfigApi.js 溯源
weightApi.js 过磅
huobanTableApi.js 伙伴云
farmPlan.js, inspection.js, inputMaterial.js, irrigation.js, park.js, fertigationDevice.js, cameraInfo.js 农业/设备
n8nApi.js N8N 工作流
extLink.js, userPreference.js 外链/偏好

3.3 工具函数删除

文件 原因
ezvizConfig.js, ezvizStream.js 萤石云视频流配置
tracingDisplay.js, tracingPermission.js, tracingQualPermission.js, tracingTestCertificate.js 溯源专用工具
huobanAuth.js 伙伴云鉴权
markdown.js 富文本编辑器封装(被 MarkdownContent.vue 替代)
wangEditConfig.js wangEditor 富文本配置

3.4 组件删除

目录/文件 原因
components/brain/ 大屏专用组件
components/tracing/ 溯源专用组件
components/MarkdownContent.vue(原版) 依赖已删除的 markdown.js,由新版替代

3.5 配置删除

文件 原因
config/ezviz.js, config/ezviz.example.js 萤石云配置
config/tracingOpenKey.js 溯源 OpenKey 配置
styles/tracing-screen.scss 溯源大屏样式

四、框架文件修改详情

4.1 router/index.js — 路由重构

修改内容

  • 移除所有业务路由(certify、huoban、weight、tracing、fei_screen、brain、tracing_screen
  • 保留核心路由:/login/register/user/*/base/*/customer/*/error/404/(首页)
  • 新增 /common 路由作为动态菜单路由的容器:
{
  path: '/common',
  component: LayoutBox,
  name: 'common',
  children: []  // 动态路由运行时注入
}

原因menuApi.js 通过 router.addRoute('common', ...) 动态注册菜单路由,需要一个名为 common 的命名路由作为父容器。

4.2 main.js — 入口精简

移除内容

  • import * as echarts from 'echarts'Vue.prototype.$echarts = echarts(首页看板不再使用 echarts 图表)
  • import userPreferenceApi from '@/api/userPreference' 及相关调用(用户偏好功能已删除)
  • staticPages 数组精简为 ['/register'](移除了其他静态页面路径)

保留内容

  • Token 从 URL 参数读取(SSO 支持)
  • getCurrentUsersetLoginUsergetMyAppsloadAppMenusmatchCurrentPath 核心启动流程

4.3 utils/request.js — 请求层简化

移除内容

  • isHuobanWebApi() 函数(判断是否为伙伴云 API 请求)
  • resolveRequestToken() 辅助函数(根据请求类型解析不同 token)
  • 伙伴云 token 相关逻辑

简化后Token 统一从 localStorage.getItem('_token') 获取:

config.headers = {
  ...config.headers,
  time: new Date().getTime(),
  version: '1.1',
  token: localStorage.getItem('_token') || ''
}

4.4 store/modules/user.js — 状态清理

移除内容

  • huobanToken state 字段
  • SET_HUOBAN_TOKEN mutation
  • setHuobanToken action

保留的 StateloginUsermenuListcurrentMenuIdcurrentCustomerappListcurrentAppcurrentAppMenusallAppMenus

4.5 store/getters.js — 清理不存在模块

移除内容:对 apppermissionerrorLogcommon 模块的 getter 引用(这些模块不存在于本项目中)

修改后

const getters = {
  visitedViews: state => state.tagsView.visitedViews,
  cachedViews: state => state.tagsView.cachedViews,
  loginUser: state => state.user.loginUser,
  currentCustomer: state => state.user.currentCustomer,
  menuList: state => state.user.menuList,
  appList: state => state.user.appList,
  currentApp: state => state.user.currentApp,
  currentAppMenus: state => state.user.currentAppMenus
}

4.6 vue.config.js — 构建配置更新

移除内容

  • MonacoWebpackPlugin require 和插件注册
  • n8n 工作流代理配置
  • echartsmonaco-editor 的 externals 配置
  • monaco/echarts/wangEditor 的 splitChunks cacheGroups

修改内容

  • outputDir: "saas-web""authon-web"
  • name: 添加 'apes-Authon'

4.7 package.json — 依赖清理

移除的依赖

  • @amap/amap-jsapi-loader(高德地图)
  • @wangeditor/core@wangeditor/editor@wangeditor/editor-for-vue(富文本编辑器)
  • echarts(图表库)
  • html2canvas(截图)
  • jspdfPDF 生成)
  • qrcodejs2(二维码)

保留的特殊依赖

  • monaco-editor — AI 工具编辑器使用(views/ai/toolEdit.vue
  • vue-monaco — Monaco Editor 的 Vue 封装
  • marked — AI 对话中的 Markdown 渲染
  • highlight.js — AI 对话中的代码高亮

4.8 public/index.html — CDN 清理

移除内容

  • echarts CDN script
  • monaco-editor CDN scriptsloader、nls、editor.main

保留内容

  • Vue、VueRouter、Vuex、ElementUI、Axios 的 CDN externals

4.9 iframeView.vue — 重写

原版:为每种 iframe 类型(web/payment/huoban)分别导入对应的 view 组件。

新版:统一为单个通用 <iframe> 组件,适用于所有 menuType 2/3/4

<template>
  <div class="iframe-container">
    <iframe :src="frameUrl" frameborder="0" style="width:100%;height:100%"></iframe>
  </div>
</template>

4.10 menuApi.js — 路由注册统一

修改内容menuType 2/3/4 统一使用 @/components/iframeView 组件,不再为每种类型分别导入 view。

4.11 MarkdownContent.vue — 新建

背景:原版 MarkdownContent.vue 导入了已删除的 @/utils/markdown.js,导致构建失败。

新版:直接使用 marked + highlight.js,自包含无外部依赖:

import { marked } from 'marked'
import hljs from 'highlight.js'
import 'highlight.js/styles/github.css'

五、业务引用清理

以下文件中移除了对已删除模块的引用,替换为空操作或简化逻辑:

文件 移除的引用 替代方案
TopHeader.vue weightApiclearTracingPermissionCacheclearHuobanToken 移除调用,保留方法结构
login/index.vue weightApiclearHuobanToken 移除调用
home/index.vue extLinkApi loadExtLinks() 改为空操作
customer/index.vue huobanTableApi upsetOne() 改为设置 skip 状态
customer/uiConfig.vue weightApi loadConfig() / handleSave() / handleReset() 改为成功提示
permissionApi.js TRACING_OPEN_KEY 移除 getTrackingConfigByCustomerId() 方法

六、构建验证

npm run build:prod
# DONE  Compiled successfully
# Build complete. The authon-web directory is ready to be deployed.

构建产物输出到 authon-web/ 目录,可直接部署到 Nginx 或其他 Web 服务器。


七、后续代办

代办 说明 状态
Phase 5A: AI/LLM 后端提取 ~54 Java 文件从源码同步到 apes-Authon 待办
Phase 5B: 系统配置页面补充 后端已有 Controller,前端已保留页面 基本完成
Phase 5C: 伙伴云表单配置 5 Controller + 7 .vue + 1 API 待办

文档更新时间: 2026-08-09 | 仓库: https://gitea.apescale.com/apes-Arise/apes-Authon-Web