From 2b2368759bf9283c7d16fcdf28363277979ae0f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BA=84=E9=94=90=E6=B3=A2?= <10549902+zhuangruibo@user.noreply.gitee.com> Date: Wed, 20 May 2026 07:55:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E5=B7=A5=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- readme.md | 55 +++++++++++++++++-- .../src/common/globalRouter.js | 12 ++++ .../router/enterprise-app/ent-base-router.js | 6 +- .../src/views/enterprise/nos/login.vue | 5 +- .../src/views/enterprise/nos/mockHome.vue | 32 ++++++++++- 5 files changed, 98 insertions(+), 12 deletions(-) diff --git a/readme.md b/readme.md index fb66708..340ad90 100644 --- a/readme.md +++ b/readme.md @@ -1,6 +1,22 @@ -* 表结构的维护全部采用sql,存入[nos](script/sql/nos)中,后续通过脚本多次重建数据库 +* git代码仓库 + ``` + http://146.56.199.25:3000/zhuibobo/EnforcementCode-NOS-2.0.git + ``` +* 数据库 + * 开发时使用227上的库zfjd2.0-nos作为开发数据库 + * 通过视图的方式引入了表,以进行必要功能的开发 + ``` + efcode_virtual_unit + srz_dept + srz_user + sys_dept + sys_user + ``` + * 部署时将合并2个库的表结构,现场和非现场的使用同一个数据库 +* 表结构的维护全部采用sql,存入[nos](script/sql/nos)文件夹中,后续会通过脚本多次重建数据库 * 非现场执法的表明全部采用 nos_开头,方便后续区分 - * 将所有非现场执法的表的都加入租户的排除表中 + * 所有表和字段都需要加上中文的comment说明 + * 将所有非现场执法的表的都加入租户的[application.yml](zdxt-web-server/zdxt-admin-web-server/src/main/resources/application.yml)yml的排除表配置中 ``` # 多租户配置 tenant: @@ -12,8 +28,11 @@ - sys_tenant - sys_tenant_package ``` - * 非现场的所有数据库表,需要增加一下字段: -* 使用[install-to-maven.ps1](Libs/install-to-maven.ps1)将jar包注册到本地的maven仓库中 + * 非现场的所有数据库表,需要增加以下字段: + ``` + + ``` +* 使用[install-to-maven.ps1](Libs/install-to-maven.ps1)将jar包注册到本地的maven仓库中,后续如果需要更新,也 * 后端的功能全部写入[zdxt-enforcement-nos](zdxt-modules/zdxt-enforcement-nos)中 * 前端分为3个 * 非现场企业端 @@ -27,8 +46,34 @@ * 关于包名的修改,生成代码的地方,导入表后,点击编辑,生成信息中可以修改导出的包名,设置为com.zdxt.enforcementnos,这样导出后,代码和现有的功能目录一致 * 前端接入方法 * 开发时 + ```mermaid + graph TD + A[开发时 App 登录页面] -->|Vite 代理转发登录请求| B["现场执法后台 /api 前缀请求(现场执法)"] + B -->|返回访问 Token| C[后续接口访问] + C --> D["/api 前缀请求(现场执法)"] + C --> E["/nosapi 前缀请求(非现场执法)"] + D -->|Vite 代理转发| F[现场执法后台] + E -->|Vite 代理转发| F + ``` * 部署时 * 从主页面进入非现场的页面时,会携带token,凭借token可以调用监督码的后台接口,获取相关的信息 -* 后端接入方法,前端进入后,先请求一次后端,将token提交给后端,后端自行存储,本次session中,凭借改token去调用后端接口 + ```mermaid + graph TD + A[从主页面进入非现场的页面时] -->|携带token进入| B["路由守卫拦截,获取token,存入$globalStore"] + B -->|返回访问 Token| C[后续接口访问] + C --> D["/api 前缀请求(现场执法)"] + C --> E["/nosapi 前缀请求(非现场执法)"] + D -->|NG 代理转发| F[现场执法后台] + E -->|NG 代理转发| F + ``` +* 后端接入方法. * 现场执法提供给非现场执法的接口,所需的参数通过接口参数传递,不要凭借token去获取数据. * 非现场执法的接口,只验证token,不要再做其他权限设置,等后边合并的时候在考虑 + * 前端进入后,先请求一次后端,将token提交给后端,后端自行存储,本次session中,凭借改token去调用后端接口 +* 后续如何将非现场的代码合入现场执法的代码中 + * 前端 + * 前端分为3个独立的工程,每个都需要独立合并一次 + * [zdxt-efcode-nos-enterprise-app](zdxt-web-client/zdxt-efcode-nos-enterprise-app) + * [zdxt-efcode-nos-supervision-app](zdxt-web-client/zdxt-efcode-nos-supervision-app) + * 后端 + * 将[zdxt-enforcement-nos](zdxt-modules/zdxt-enforcement-nos)模块的代码拷贝到现场执法的代码中,应该就可以直接使用 diff --git a/zdxt-web-client/zdxt-efcode-nos-enterprise-app/src/common/globalRouter.js b/zdxt-web-client/zdxt-efcode-nos-enterprise-app/src/common/globalRouter.js index 6cd8d27..3e3ee32 100644 --- a/zdxt-web-client/zdxt-efcode-nos-enterprise-app/src/common/globalRouter.js +++ b/zdxt-web-client/zdxt-efcode-nos-enterprise-app/src/common/globalRouter.js @@ -31,6 +31,18 @@ $globalRouter.beforeEach((to, from, next) => { const title = to.meta?.title || to.title || '执法监督码'; document.title = title; + // 免登录绿色通道:若 URL 携带 ?token=xxx,直接写入 store, + // 后续 http 请求拦截器会自动取该 token 作为 Authorization 发送 + const urlToken = to.query?.token; + if (urlToken && typeof urlToken === 'string') { + try { + $globalStore.useCommon.SET_TOKEN(urlToken); + console.log('[router] URL token 已注入 store'); + } catch (e) { + console.warn('[router] URL token 注入失败', e); + } + } + // let pattern3 = new RegExp("^[0-9]*$"); // if (null != to.query) { // for (let key in to.query) { diff --git a/zdxt-web-client/zdxt-efcode-nos-enterprise-app/src/router/enterprise-app/ent-base-router.js b/zdxt-web-client/zdxt-efcode-nos-enterprise-app/src/router/enterprise-app/ent-base-router.js index 7675293..1afd554 100644 --- a/zdxt-web-client/zdxt-efcode-nos-enterprise-app/src/router/enterprise-app/ent-base-router.js +++ b/zdxt-web-client/zdxt-efcode-nos-enterprise-app/src/router/enterprise-app/ent-base-router.js @@ -3,7 +3,7 @@ const routes = [ // 企业端根路径重定向 { path: "/enterprise", - redirect: "/enterprise/enterpriseHome", + redirect: "/enterprise/mockHome", name: "enterpriseRoot", }, // 企业端登录 @@ -18,8 +18,8 @@ const routes = [ }, // 企业端首页 { - path: "/enterprise/enterpriseHome", - name: "enterpriseHome", + path: "/enterprise/mockHome", + name: "mockHome", component: () => import("@/views/enterprise/nos/mockHome.vue"), meta: { isKeepAlive: false, diff --git a/zdxt-web-client/zdxt-efcode-nos-enterprise-app/src/views/enterprise/nos/login.vue b/zdxt-web-client/zdxt-efcode-nos-enterprise-app/src/views/enterprise/nos/login.vue index f5f37d7..f32912f 100644 --- a/zdxt-web-client/zdxt-efcode-nos-enterprise-app/src/views/enterprise/nos/login.vue +++ b/zdxt-web-client/zdxt-efcode-nos-enterprise-app/src/views/enterprise/nos/login.vue @@ -79,6 +79,7 @@ useCommon.SET_TOKEN(response.data.token); //debugger; console.log("message",useCommon.userId); + console.log("token",response.data.token); // 暂时不调用获取关联企业信息接口 // getUserRefEnterpriseInfo({userId: response.data.userId}, res => { // console.log("getUserRefEnterpriseInfo", res); @@ -91,12 +92,12 @@ // showToast('您关联了多个企业,已默认选择企业:' + (firstEnterprise.enterpriseName || '')); // } // } - // router.push({name: "enterpriseHome"}); + // router.push({name: "mockHome"}); // }, () => { // // 获取企业信息失败也照常跳转 // showFailToast("获取企业信息失败!"); // }); - router.push({name: "enterpriseHome"}); + router.push({name: "mockHome"}); } else { showFailToast(response.msg || "登录失败"); } diff --git a/zdxt-web-client/zdxt-efcode-nos-enterprise-app/src/views/enterprise/nos/mockHome.vue b/zdxt-web-client/zdxt-efcode-nos-enterprise-app/src/views/enterprise/nos/mockHome.vue index a22308c..8bfed6d 100644 --- a/zdxt-web-client/zdxt-efcode-nos-enterprise-app/src/views/enterprise/nos/mockHome.vue +++ b/zdxt-web-client/zdxt-efcode-nos-enterprise-app/src/views/enterprise/nos/mockHome.vue @@ -67,8 +67,11 @@