From 75491c94487494f536feb58616a097358681b1f9 Mon Sep 17 00:00:00 2001
From: wangzenghua <1048523306@qq.com>
Date: Fri, 28 Feb 2025 06:28:54 +0000
Subject: [PATCH 1/3] fix:router
---
main/.env.test | 1 -
main/src/micro/actions.js | 3 --
main/src/store/modules/permission.js | 1 -
main/src/store/modules/setting.js | 52 -------------------
main/src/utils/permission.js | 5 +-
main/src/views/index.vue | 9 +---
main/vite.config.js | 32 +++---------
sub-government-affairs-service/index.html | 2 +-
sub-government-affairs-service/src/App.vue | 2 +-
.../src/config/index.js | 2 +-
sub-government-affairs-service/src/main.js | 46 ++++------------
.../src/plugins/micro.js | 8 +--
.../src/router/index.js | 31 ++++-------
.../src/router/modules/plantingAndBreeding.js | 28 +++++-----
.../src/router/modules/resource.js | 6 +--
.../src/store/modules/setting.js | 3 +-
.../src/utils/permission.js | 6 ++-
.../src/views/trace/breeding/coding/index.vue | 4 +-
sub-government-affairs-service/vite.config.js | 34 ++++--------
19 files changed, 71 insertions(+), 204 deletions(-)
diff --git a/main/.env.test b/main/.env.test
index c4f70bf..be802d2 100644
--- a/main/.env.test
+++ b/main/.env.test
@@ -1,5 +1,4 @@
# 开发环境
-VITE_PORT = 9000
VITE_APP_NAME = 'daimp-front-main'
VITE_APP_TITLE = '数字农业产业管理平台'
VITE_APP_SUB_OS = '//localhost:8090/sub-operation-service/'
diff --git a/main/src/micro/actions.js b/main/src/micro/actions.js
index 256275d..051a066 100644
--- a/main/src/micro/actions.js
+++ b/main/src/micro/actions.js
@@ -18,9 +18,6 @@ actions.onGlobalStateChange((newState, prev) => {
}
});
-// 有key,表示取globalState下的某个子级对象
-// 无key,表示取全部
-
actions.getGlobalState = (key) => {
return key ? initialState[key] : initialState;
};
diff --git a/main/src/store/modules/permission.js b/main/src/store/modules/permission.js
index 9d95a93..e1604fb 100644
--- a/main/src/store/modules/permission.js
+++ b/main/src/store/modules/permission.js
@@ -25,7 +25,6 @@ export const usePermissionStore = defineStore({
actions: {
generateRoutes(roles) {
return new Promise((resolve) => {
- // 在这判断是否有权限,哪些角色拥有哪些权限
const UserStore = useUserStore();
this.asyncRoutes = createAsyncRoutes(getTree(UserStore.getMenus()));
let accessedRoutes;
diff --git a/main/src/store/modules/setting.js b/main/src/store/modules/setting.js
index b12e32d..35aef83 100644
--- a/main/src/store/modules/setting.js
+++ b/main/src/store/modules/setting.js
@@ -1,64 +1,12 @@
import { defineStore } from 'pinia';
-import { CONSTANTS } from '@/config';
export const useSettingStore = defineStore({
id: 'settingStore',
state: () => ({
- // menu 是否收缩
- isCollapse: true,
- //
- withoutAnimation: false,
- device: 'desktop',
- // 刷新当前页
isReload: true,
- // 主题设置
- themeConfig: {
- // 显示设置
- showSetting: false,
- // 菜单展示模式 默认 vertical horizontal / vertical /columns
- mode: 'vertical',
- // tagsView 是否展示 默认展示
- showTag: true,
- // 页脚
- footer: true,
- // 深色模式 切换暗黑模式
- isDark: false,
- // 显示侧边栏Logo
- showLogo: true,
- // 主题颜色
- primary: CONSTANTS.PRIMARY,
- // element组件大小
- globalComSize: 'default',
- // 是否只保持一个子菜单的展开
- uniqueOpened: true,
- // 固定header
- fixedHeader: true,
- // 灰色模式
- gray: false,
- // 色弱模式
- weak: false,
- },
}),
getters: {},
actions: {
- // 设置主题
- setThemeConfig({ key, val }) {
- this.themeConfig[key] = val;
- },
- // 切换 Collapse
- setCollapse(value) {
- this.isCollapse = value;
- this.withoutAnimation = false;
- },
- // 关闭侧边栏
- closeSideBar({ withoutAnimation }) {
- this.isCollapse = false;
- this.withoutAnimation = withoutAnimation;
- },
- toggleDevice(device) {
- this.device = device;
- },
- // 刷新
setReload() {
this.isReload = false;
setTimeout(() => {
diff --git a/main/src/utils/permission.js b/main/src/utils/permission.js
index 0b1d55c..2d203b0 100644
--- a/main/src/utils/permission.js
+++ b/main/src/utils/permission.js
@@ -34,9 +34,10 @@ router.beforeEach(async (to, from, next) => {
if (!PermissionStore.routes.length) {
const accessRoutes = await PermissionStore.generateRoutes(userStore.roles);
accessRoutes.forEach((item) => router.addRoute(item));
- next({ ...to, replace: true });
+ return next({ ...to, replace: true });
} else {
- if (from.path.includes('/sub') && !to.path.includes('/sub')) {
+ if (from.path.includes('/sub') && (!to.path.includes('/sub') || to.path.includes('/platform'))) {
+ NProgress.done();
window.location.reload();
return;
}
diff --git a/main/src/views/index.vue b/main/src/views/index.vue
index 84e4b52..c52f0eb 100644
--- a/main/src/views/index.vue
+++ b/main/src/views/index.vue
@@ -36,22 +36,15 @@ import actions from '@/micro/actions';
import { getAssetsFile } from '@/utils';
const gotoPage = (row) => {
- // const curentApp = microApps.find((item) => row.name === item.name);
- // actions.setGlobalState({
- // curentApp,
- // });
- // console.log('===', actions.getGlobalState('user'));
- // if (row.name !== 'sub-government-affairs-service') return;
window.history.pushState({}, row.name, row.activeRule);
};
diff --git a/sub-government-affairs-service/src/views/annualPlan/component/annualPlans/index.vue b/sub-government-affairs-service/src/views/annualPlan/component/annualPlans/index.vue
index 647cd1e..8aa830d 100644
--- a/sub-government-affairs-service/src/views/annualPlan/component/annualPlans/index.vue
+++ b/sub-government-affairs-service/src/views/annualPlan/component/annualPlans/index.vue
@@ -1,51 +1,40 @@
-
-
-
-
-
-
-
-
-
- 查询
- 重置
-
-
-
-
-
- {{ item.label }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 待提交
- 审核中
- 通过
- 拒绝
-
-
-
-
- 审核
- 编辑
- 详情
- 删除
-
-
-
-
+
+
+
+ 新增
+ 导出
+
+
+
+ 待提交
+ 审核中
+ 通过
+ 拒绝
+
+
+
+
+
+
+
@@ -71,7 +60,7 @@
-
+
周
@@ -117,89 +106,63 @@
-
+
+
+
+ {{ currentRow.id || '--' }}
+ {{ currentRow.planName || '--' }}
+ {{ currentRow.plantingArea || '--' }}
+ {{ currentRow.plantingMonths || '--' }}
+ {{ currentRow.growthCycle || '--' }}
+ {{ currentRow.note || '--' }}
+ {{ currentRow.planProgress || '--' }}
+
+ 待提交
+ 审核中
+ 通过
+ 拒绝
+
+
+
+
+
+
+
-
-
-
diff --git a/sub-government-affairs-service/src/views/annualPlan/component/plantings/index.vue b/sub-government-affairs-service/src/views/annualPlan/component/plantings/index.vue
index e69de29..73201b1 100644
--- a/sub-government-affairs-service/src/views/annualPlan/component/plantings/index.vue
+++ b/sub-government-affairs-service/src/views/annualPlan/component/plantings/index.vue
@@ -0,0 +1,3 @@
+
+ 网格种植进度
+
diff --git a/sub-government-affairs-service/src/views/landManage/component/plantPlan/index copy.vue b/sub-government-affairs-service/src/views/landManage/component/plantPlan/index copy.vue
new file mode 100644
index 0000000..ee4db7a
--- /dev/null
+++ b/sub-government-affairs-service/src/views/landManage/component/plantPlan/index copy.vue
@@ -0,0 +1,663 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 重置
+
+
+
+
+
+ {{ item.label }}
+
+
+
+
+
+
+
+
+
+
+ {{ landClassificationType[row.landClassificationType] }}
+
+
+
+
+
+
+
+
+
+
+
+ 编辑
+ 删除
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
种植阶段详情
+
+
+
+
+ 新增
+
+
+
+
+
+
+
+
+
+ 查询
+ 重置
+
+
+
+
+
+
+
+ {{ stageObj[row.stage] }}
+
+
+
+
+
+
+
+ 编辑
+ 删除
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sub-government-affairs-service/src/views/landManage/component/plantPlan/index.vue b/sub-government-affairs-service/src/views/landManage/component/plantPlan/index.vue
index ee4db7a..f56b9b1 100644
--- a/sub-government-affairs-service/src/views/landManage/component/plantPlan/index.vue
+++ b/sub-government-affairs-service/src/views/landManage/component/plantPlan/index.vue
@@ -1,61 +1,42 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 查询
- 重置
-
-
-
-
-
- {{ item.label }}
-
-
-
-
-
-
-
-
-
-
- {{ landClassificationType[row.landClassificationType] }}
-
-
-
-
-
-
-
-
-
-
-
- 编辑
- 删除
-
-
-
-
-
+
+
+
+ 新增
+ 导入
+ 导出
+
+
+
+
+ {{ landClassificationType[row.landClassificationType] || '未知' }}
+
+
+
+
+
+
+
+
+