From 580402c132376270b34e8519c79019e2dde8072c Mon Sep 17 00:00:00 2001 From: sankeyangshu <1260323835@qq.com> Date: Mon, 2 Dec 2024 19:49:22 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 21 +- src/api/Boat/info.ts | 12 +- src/api/Manifest/index.ts | 2 +- src/api/Notice/index.ts | 2 +- src/components/Pagination/Pagination.vue | 2 +- src/config/permission.ts | 27 +- src/hooks/useTheme.ts | 160 ------- src/layouts/Header/index.vue | 18 +- src/layouts/Sidebar/index.vue | 1 - src/layouts/index.vue | 5 +- src/store/modules/permission.ts | 48 --- src/store/modules/setting.ts | 88 +--- src/store/modules/tagsView.ts | 125 ------ src/store/modules/user.ts | 2 +- src/types/boatInfo.ts | 2 +- src/types/manifest.ts | 1 + src/utils/request/CheckStatus.ts | 27 -- src/utils/request/request.ts | 2 +- src/views/ApiManage/components/ApiTable.vue | 69 ++- src/views/Boat/components/BoatTable.vue | 122 +++--- src/views/Help/components/AgreeText.vue | 15 +- src/views/Help/components/HelpTable.vue | 2 +- src/views/Help/index.vue | 72 ++-- src/views/History/components/PublishTable.vue | 36 +- src/views/History/components/ReceiveTable.vue | 76 +++- src/views/Home/index.vue | 35 +- src/views/Login/index.vue | 7 +- .../Manifest/components/ManifestTable.vue | 404 ++++++++++++++---- src/views/Manifest/index.vue | 73 +--- src/views/Notice/index.vue | 8 +- src/views/Send/components/Send.vue | 2 +- src/views/Send/components/SendTable.vue | 75 ++-- src/views/Setting/components/EmployeeRole.vue | 33 +- .../Setting/components/EmployeeTable.vue | 32 +- src/views/Setting/components/Wharf.vue | 25 +- src/views/Setting/index.vue | 72 ++-- src/views/User/index.vue | 4 +- 37 files changed, 850 insertions(+), 857 deletions(-) delete mode 100644 src/hooks/useTheme.ts delete mode 100644 src/store/modules/permission.ts delete mode 100644 src/store/modules/tagsView.ts diff --git a/src/App.vue b/src/App.vue index 8ceafc3..89864ab 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,30 +1,11 @@ diff --git a/src/api/Boat/info.ts b/src/api/Boat/info.ts index 65140de..6e0460d 100644 --- a/src/api/Boat/info.ts +++ b/src/api/Boat/info.ts @@ -1,4 +1,4 @@ -import { PageRowsResult } from '@/types'; +import { dictionaryListType, dictionaryType, PageRowsResult } from '@/types'; import { BoatInfoPageType, BoatInfoType, vinSearchType } from '@/types/boatInfo'; import http from '@/utils/request'; @@ -14,6 +14,7 @@ const api = { publishHistoryList: '/cargo/sail_schedule/history/publish/page', // 我发布的历史数据 receiveHistoryList: '/cargo/sail_schedule/history/receive/page', // 我接受的历史数据 vinSearch: '/cargo/sail_schedule/vin/query', // 车架号查询 + shipList: '/cargo/sail_schedule/ship/list', // 订阅的船期列表 }; /** @@ -112,3 +113,12 @@ export function getReceiveHistoryListAPI(data: Partial) { export function getVinSearchAPI(data: { vin: string }) { return http.get(api.vinSearch, data); } + +/** + * 订阅的船舶字典列表 + * @param {dictionaryType} data 字典参数 + * @return 返回请求字典列表接口的结果 + */ +export function postSaleShipListAPI(data: dictionaryType) { + return http.get(api.shipList, data); +} diff --git a/src/api/Manifest/index.ts b/src/api/Manifest/index.ts index ee64149..9047296 100644 --- a/src/api/Manifest/index.ts +++ b/src/api/Manifest/index.ts @@ -6,7 +6,7 @@ import http from '@/utils/request'; const api = { manifestDel: '/cargo/manifest/delete', // 删除 manifestGet: '/cargo/manifest/get', // 获取 - manifestPage: '/cargo/manifest/page', // 分页列表 + manifestPage: '/cargo/manifest/subscribe/page', // 我订阅的分页列表 manifestSave: '/cargo/manifest/save', // 保存 manifestImport: '/cargo/manifest/import', // 舱单导入 manifestExport: '/cargo/manifest/tmp/export', // 下载模版 diff --git a/src/api/Notice/index.ts b/src/api/Notice/index.ts index 5afe7b4..21d8cee 100644 --- a/src/api/Notice/index.ts +++ b/src/api/Notice/index.ts @@ -52,5 +52,5 @@ export function noticeSaveAPI(data: Partial) { * @return 返回请求公告数量接口的结果 */ export function noticeCountAPI() { - return http.get(api.noticeCount); + return http.get(api.noticeCount); } diff --git a/src/components/Pagination/Pagination.vue b/src/components/Pagination/Pagination.vue index 71906a0..5d675cc 100644 --- a/src/components/Pagination/Pagination.vue +++ b/src/components/Pagination/Pagination.vue @@ -6,7 +6,7 @@ :page-size="pageAble.rows" :page-sizes="[10, 25, 50, 100]" :total="pageAble.total" - layout="total, sizes, prev, pager, next, jumper" + layout="prev, pager, next, total" @size-change="handleSizeChange" @current-change="handleCurrentChange" > diff --git a/src/config/permission.ts b/src/config/permission.ts index 22df4c3..5ac99e3 100644 --- a/src/config/permission.ts +++ b/src/config/permission.ts @@ -1,6 +1,5 @@ import NProgress from 'nprogress'; // 进度条 import { router } from '@/router'; -import { usePermissionStore } from '@/store/modules/permission'; import { useUserStore } from '@/store/modules/user'; import 'nprogress/nprogress.css'; // 进度条样式 @@ -16,7 +15,7 @@ const whiteList = ['/login']; * @param from 从哪里来 * @param next 是否要去 */ -router.beforeEach(async (to, from, next) => { +router.beforeEach(async (to, _, next) => { // 进度条开始 NProgress.start(); @@ -36,28 +35,8 @@ router.beforeEach(async (to, from, next) => { // 如果已登录,重定向到主页 next({ path: '/' }); } else { - // 获取用户权限 store - const permissionStore = usePermissionStore(); - // 确定用户是否已通过getInfo获得其权限角色 - // const hasRoles = userStore.roles && userStore.roles.length > 0; - try { - // 路由添加进去了没有及时更新 需要重新进去一次拦截 - if (!permissionStore.routes.length) { - // 获取权限列表进行接口访问 因为这里页面要切换权限 - const accessRoutes = await permissionStore.generateRoutes(userStore.roles); - - // 动态添加访问路由表 - accessRoutes.forEach((item) => router.addRoute(item)); - - // 这里相当于push到一个页面 不在进入路由拦截 - next({ ...to, replace: true }); - } else { - // 如果不传参数就会重新执行路由拦截,重新进到这里 - next(); - } - } catch (error) { - next(`/login?redirect=${to.path}`); - } + // 如果不传参数就会重新执行路由拦截,重新进到这里 + next(); } } else { // 用户未登录 diff --git a/src/hooks/useTheme.ts b/src/hooks/useTheme.ts deleted file mode 100644 index ac38771..0000000 --- a/src/hooks/useTheme.ts +++ /dev/null @@ -1,160 +0,0 @@ -import { ElMessage } from 'element-plus'; -import { computed } from 'vue'; -import { DEFAULT_THEMECOLOR } from '@/config'; -import { useSettingStore } from '@/store/modules/setting'; -import { headerTheme, menuTheme, sidebarTheme } from '@/styles/theme'; -import { getDarkColor, getLightColor } from '@/utils/color'; - -/** - * 主题类型 - */ -export type ThemeType = 'light' | 'inverted' | 'dark'; - -/** - * 灰色和弱色类型 - */ -export type GreyOrWeakType = 'grey' | 'weak'; - -/** - * 全局主题设置 - */ -export const useTheme = () => { - // 获取全局状态管理仓库中系统设置状态 - const settingStore = useSettingStore(); - const themeConfig = computed(() => settingStore.themeConfig); - - // 切换暗黑模式 - const switchDark = () => { - const body = document.documentElement; - - if (themeConfig.value.isDark) { - body.setAttribute('class', 'dark'); - } else { - body.setAttribute('class', ''); - } - - // 同时修改主题色、侧边栏、头部颜色 - changeThemeColor(themeConfig.value.themeColor); - changeSideBarTheme(); - changeHeaderTheme(); - }; - - /** - * 修改主题颜色 - * @param {string} val 主题色 - */ - const changeThemeColor = (val: string | null) => { - if (!val) { - val = DEFAULT_THEMECOLOR; - ElMessage({ type: 'success', message: `主题颜色已重置为 ${DEFAULT_THEMECOLOR}` }); - } - // 计算主题颜色变化 - document.documentElement.style.setProperty('--el-color-primary', val); - document.documentElement.style.setProperty( - '--el-color-primary-dark-2', - themeConfig.value.isDark ? `${getLightColor(val, 0.2)}` : `${getDarkColor(val, 0.3)}` - ); - for (let i = 1; i <= 9; i++) { - const primaryColor = themeConfig.value.isDark - ? `${getDarkColor(val, i / 10)}` - : `${getLightColor(val, i / 10)}`; - document.documentElement.style.setProperty(`--el-color-primary-light-${i}`, primaryColor); - } - settingStore.setThemeConfig('themeColor', val); - }; - - /** - * 灰色和弱色切换 - * @param {GreyOrWeakType} type 类型 - * @param {boolean} value 值 - */ - const changeGreyOrWeak = (type: GreyOrWeakType, value: boolean) => { - const body = document.body as HTMLElement; - if (!value) return body.removeAttribute('style'); - const styles: Record = { - grey: 'filter: grayscale(1)', - weak: 'filter: invert(80%)', - }; - body.setAttribute('style', styles[type]); - const propName = type === 'grey' ? 'isWeak' : 'isGrey'; - settingStore.setThemeConfig(propName, false); - }; - - /** - * 设置菜单样式 - */ - const changeMenuTheme = () => { - let type: ThemeType = 'light'; - - // 判断是否是暗黑主题 - if (themeConfig.value.isDark) { - type = 'dark'; - } - - const theme = menuTheme[type]; - // 遍历写入样式 - for (const [key, value] of Object.entries(theme)) { - document.documentElement.style.setProperty(key, value); - } - }; - - /** - * 设置侧边栏样式 - */ - const changeSideBarTheme = () => { - let type: ThemeType = 'light'; - - // 判断是否是暗黑主题 - if (themeConfig.value.isDark) { - type = 'dark'; - } - - const theme = sidebarTheme[type]; - // 遍历写入样式 - for (const [key, value] of Object.entries(theme)) { - document.documentElement.style.setProperty(key, value); - } - - changeMenuTheme(); - }; - - /** - * 设置头部样式 - */ - const changeHeaderTheme = () => { - let type: ThemeType = 'light'; - - // 判断是否是暗黑主题 - if (themeConfig.value.isDark) { - type = 'dark'; - } - - const theme = headerTheme[type]; - // 遍历写入样式 - for (const [key, value] of Object.entries(theme)) { - document.documentElement.style.setProperty(key, value); - } - - changeMenuTheme(); - }; - - // 初始化主题 - const initTheme = () => { - switchDark(); - - // 判断是否是灰色模式 - if (themeConfig.value.isGrey) changeGreyOrWeak('grey', true); - - // 判断是否色弱模式 - if (themeConfig.value.isWeak) changeGreyOrWeak('weak', true); - }; - - return { - switchDark, - changeThemeColor, - changeGreyOrWeak, - initTheme, - changeSideBarTheme, - changeHeaderTheme, - }; -}; diff --git a/src/layouts/Header/index.vue b/src/layouts/Header/index.vue index fba16dd..92e5414 100644 --- a/src/layouts/Header/index.vue +++ b/src/layouts/Header/index.vue @@ -15,7 +15,17 @@ @click="onClickMenu(item)" > - {{ item.title }} + + {{ item.title }} @@ -23,6 +33,7 @@