From dc801a0ba15912be81482f254ca6025824236db3 Mon Sep 17 00:00:00 2001 From: biybuy <1368735060@qq.com> Date: Mon, 23 Mar 2026 10:00:44 +0800 Subject: [PATCH] 20260323 --- debug-full-flow.js | 6 + ...�°前端页面设计规范.md => 前端页面设计规范.md} | 0 generate-menu-excel.js | 6 + scripts/copy-login-map-assets.js | 6 + scripts/debug-parse-curl-smoke.js | 6 + scripts/generate-order-template.js | 6 + .../serviceProviderInterface.ts | 2 - src/api/rbac/axios-config.ts | 14 +- .../rbac/generated/core/CancelablePromise.ts | 2 +- src/components/HandsontablePro/index.vue | 67 +- src/components/InterfaceDetail/index.vue | 2 +- src/components/ModalForm/index.vue | 16 +- src/components/PaginationPro/index.vue | 9 +- src/components/QuantityInput/index.vue | 1 - src/components/TablePro/index.vue | 12 - src/components/Timezone/index.vue | 1 - src/components/navbar/Message.vue | 1 - src/components/navbar/index.vue | 3 +- src/components/top-nav/RightTopMessage.vue | 1 - src/composables/useMessage.tsx | 2 +- src/composables/useSystemConfig.ts | 1 - src/composables/useTableContainerHeight.ts | 50 ++ src/layout/page-layout.vue | 27 +- src/router/dynamicRouter.ts | 38 +- src/router/guard/permission.ts | 2 - src/store/modules/auth/index.ts | 3 - src/store/modules/rbac-user.ts | 1 - src/store/modules/user/index.ts | 1 - src/utils/request.ts | 8 - src/views/api/callStatistics/index.vue | 15 +- src/views/api/downstreamInterface/index.vue | 5 +- src/views/api/requestLog/index.vue | 5 +- .../components/map-service-provider.vue | 19 +- src/views/channel/blacklist/index.vue | 2 +- src/views/channel/remoteZones/index.vue | 2 +- src/views/channel/serviceChannels/index.vue | 2 - src/views/operation/inboundScan/index.vue | 114 +-- src/views/operation/outboundScan/index.vue | 113 +-- src/views/operation/printLabel/index.vue | 113 +-- src/views/order/myOrders/index.vue | 33 +- src/views/order/priceCheck/index.vue | 825 ++---------------- .../order/priceCheck/mockPriceResults.ts | 256 ++++++ src/views/system/organization/index.vue | 20 +- src/views/system/organization/user/index.vue | 259 +++--- src/views/system/permission/menu/index.vue | 20 +- src/views/system/permission/role/index.vue | 186 ++-- src/views/system/warehouseAddress/index.vue | 23 +- src/views/test/InterfaceDetailTest.vue | 4 - src/views/track/kpiRegion/index.vue | 4 +- src/views/track/trackContent/index.vue | 58 +- src/views/track/trackFlag/index.vue | 58 +- src/views/track/trackMapping/Pull.vue | 8 +- src/views/track/trackMapping/Push.vue | 4 +- .../components/TrackOrderDetailDrawer.vue | 67 +- .../composables/useTrackOrderData.ts | 2 +- src/views/track/trackOrder/index.vue | 44 +- src/views/track/trackState/index.vue | 58 +- .../trackWarningOrder/CompleteWarning.vue | 10 +- .../track/trackWarningOrder/ReturnWarning.vue | 10 +- .../track/trackWarningOrder/TimeWaring.vue | 10 +- src/views/user/customer/index.vue | 216 ++--- src/views/user/recharge/rechargeRecord.vue | 155 ++-- test-debug-interface.js | 6 + test-full-api-test-flow.js | 6 + vite.config.ts | 48 +- 65 files changed, 1382 insertions(+), 1692 deletions(-) rename docs/{中后台前端页面设计规范.md => 前端页面设计规范.md} (100%) create mode 100644 src/composables/useTableContainerHeight.ts create mode 100644 src/views/order/priceCheck/mockPriceResults.ts diff --git a/debug-full-flow.js b/debug-full-flow.js index 6b9f7bb..ab3c3dc 100644 --- a/debug-full-flow.js +++ b/debug-full-flow.js @@ -1,4 +1,10 @@ // Debug the full flow: interface data -> component processing +const VERBOSE_SCRIPT_LOGS = process.env.DEBUG_SCRIPT_LOGS === 'true'; +if (!VERBOSE_SCRIPT_LOGS) { + console.log = () => {}; + console.warn = () => {}; +} + console.log('=== Debugging Full Flow ===\n'); // 模拟后端返回的接口数据 diff --git a/docs/中后台前端页面设计规范.md b/docs/前端页面设计规范.md similarity index 100% rename from docs/中后台前端页面设计规范.md rename to docs/前端页面设计规范.md diff --git a/generate-menu-excel.js b/generate-menu-excel.js index 2b1e3c5..f0ed4f9 100644 --- a/generate-menu-excel.js +++ b/generate-menu-excel.js @@ -2,6 +2,12 @@ import fs from 'fs'; import path from 'path'; +const VERBOSE_SCRIPT_LOGS = process.env.DEBUG_SCRIPT_LOGS === 'true'; +if (!VERBOSE_SCRIPT_LOGS) { + console.log = () => {}; + console.warn = () => {}; +} + // 菜单配置数据(从路由配置中提取) const menuData = [ // 一级菜单 - 首页 diff --git a/scripts/copy-login-map-assets.js b/scripts/copy-login-map-assets.js index 3f6d070..b9e53b9 100644 --- a/scripts/copy-login-map-assets.js +++ b/scripts/copy-login-map-assets.js @@ -7,6 +7,12 @@ import { mkdir, copyFile, access, writeFile } from 'fs/promises'; import { join, dirname } from 'path'; import { fileURLToPath } from 'url'; +const VERBOSE_SCRIPT_LOGS = process.env.DEBUG_SCRIPT_LOGS === 'true'; +if (!VERBOSE_SCRIPT_LOGS) { + console.log = () => {}; + console.warn = () => {}; +} + const __dirname = dirname(fileURLToPath(import.meta.url)); const root = join(__dirname, '..'); const publicDir = join(root, 'public'); diff --git a/scripts/debug-parse-curl-smoke.js b/scripts/debug-parse-curl-smoke.js index 4edb9fe..61d8b61 100644 --- a/scripts/debug-parse-curl-smoke.js +++ b/scripts/debug-parse-curl-smoke.js @@ -7,6 +7,12 @@ * Note: this script doesn't import Vue component code; it mirrors the key parsing * logic for the reported curl pattern (multi-line with --data-urlencode). */ +const VERBOSE_SCRIPT_LOGS = process.env.DEBUG_SCRIPT_LOGS === 'true'; +if (!VERBOSE_SCRIPT_LOGS) { + console.log = () => {}; + console.warn = () => {}; +} + const sample = `curl --location 'https://3pe.itdida.com/itdida-api/login' \\ --header 'Content-Type: application/x-www-form-urlencoded' \\ --data-urlencode 'password=DQC123456' \\ diff --git a/scripts/generate-order-template.js b/scripts/generate-order-template.js index 33931ea..41a9746 100644 --- a/scripts/generate-order-template.js +++ b/scripts/generate-order-template.js @@ -8,6 +8,12 @@ import { fileURLToPath } from 'url' import { dirname, join } from 'path' import { mkdirSync, existsSync } from 'fs' +const VERBOSE_SCRIPT_LOGS = process.env.DEBUG_SCRIPT_LOGS === 'true' +if (!VERBOSE_SCRIPT_LOGS) { + console.log = () => {} + console.warn = () => {} +} + const __filename = fileURLToPath(import.meta.url) const __dirname = dirname(__filename) diff --git a/src/api/InterfaceServices/serviceProviderInterface.ts b/src/api/InterfaceServices/serviceProviderInterface.ts index ba48900..3984ab5 100644 --- a/src/api/InterfaceServices/serviceProviderInterface.ts +++ b/src/api/InterfaceServices/serviceProviderInterface.ts @@ -8,7 +8,6 @@ export async function postInterfaceServiceProviderInterfacePaginatedList( body: any, options?: { [key: string]: any } ) { - console.warn('postInterfaceServiceProviderInterfacePaginatedList 是临时占位函数,需要实现真实的API'); return request(`api/ServiceProviderInterface/PaginatedList`, { method: 'POST', headers: { @@ -24,7 +23,6 @@ export async function postInterfaceBatchDeleteServiceProviderInterfaceByIds( body: number[], options?: { [key: string]: any } ) { - console.warn('postInterfaceBatchDeleteServiceProviderInterfaceByIds 是临时占位函数,需要实现真实的API'); return request(`api/Interface/BatchDeleteInterfaceByIds`, { method: 'POST', headers: { diff --git a/src/api/rbac/axios-config.ts b/src/api/rbac/axios-config.ts index ff5c1ae..7e48902 100644 --- a/src/api/rbac/axios-config.ts +++ b/src/api/rbac/axios-config.ts @@ -64,20 +64,8 @@ axiosInstance.interceptors.request.use( config.headers.Authorization = `Bearer ${token}` } - // 调试信息 - const isDev = (import.meta as any).env?.MODE === 'development' - if (isDev) { - console.log('[RBAC Request] Authorization header set:', config.headers.Authorization?.substring(0, 20) + '...') - } } else { - // 调试信息:如果没有 token,记录日志(生产环境也记录,方便排查) - const isDev = (import.meta as any).env?.MODE === 'development' - console.warn('[RBAC Request] No token found:', { - hasAccessToken: !!userStore.accessToken, - hasOpenAPIToken: !!OpenAPI.TOKEN, - url: config.url, - isDev - }) + // 没有 token 时静默(由后续 401 统一处理) } return config diff --git a/src/api/rbac/generated/core/CancelablePromise.ts b/src/api/rbac/generated/core/CancelablePromise.ts index eb02246..0982c06 100644 --- a/src/api/rbac/generated/core/CancelablePromise.ts +++ b/src/api/rbac/generated/core/CancelablePromise.ts @@ -117,7 +117,7 @@ export class CancelablePromise implements Promise { cancelHandler(); } } catch (error) { - console.warn('Cancellation threw an error', error); + console.error('Cancellation threw an error', error); return; } } diff --git a/src/components/HandsontablePro/index.vue b/src/components/HandsontablePro/index.vue index 98f8bc2..41b1c30 100644 --- a/src/components/HandsontablePro/index.vue +++ b/src/components/HandsontablePro/index.vue @@ -240,7 +240,7 @@ // 操作列(在前面) if (props.showActionColumn && props.actionColumnPosition === 'start') { - columns.push({ data: currentDataIndex, type: 'text', readOnly: true, width: 60, className: 'htCenter', headerClassName: 'htLeft' }); + columns.push({ data: currentDataIndex, type: 'text', readOnly: true, width: props.actionColumnWidth, className: 'htCenter', headerClassName: 'htLeft' }); headerTexts.push('操作'); currentDataIndex++; } @@ -263,7 +263,7 @@ effectiveColumns.value.forEach((col, index) => { // beforeLast:在倒数第二列后插入操作列 if (props.showActionColumn && props.actionColumnPosition === 'beforeLast' && index === dataColCount - 1) { - columns.push({ data: currentDataIndex, type: 'text', readOnly: true, width: 60, className: 'htCenter', headerClassName: 'htLeft' }); + columns.push({ data: currentDataIndex, type: 'text', readOnly: true, width: props.actionColumnWidth, className: 'htCenter', headerClassName: 'htLeft' }); headerTexts.push('操作'); currentDataIndex++; } @@ -281,7 +281,7 @@ // 操作列(在后面,非 beforeLast 时) if (props.showActionColumn && props.actionColumnPosition === 'end') { - columns.push({ data: currentDataIndex, type: 'text', readOnly: true, width: 60, className: 'htCenter', headerClassName: 'htLeft' }); + columns.push({ data: currentDataIndex, type: 'text', readOnly: true, width: props.actionColumnWidth, className: 'htCenter', headerClassName: 'htLeft' }); headerTexts.push('操作'); currentDataIndex++; } @@ -1061,21 +1061,10 @@ hotInstance.loadData(data); hotInstance.render(); - // 刷新尺寸以确保滚动条正确显示 + // 刷新尺寸以确保 Handsontable 内置滚动视口(.wtHolder)尺寸正确 setTimeout(() => { if (hotInstance) { hotInstance.refreshDimensions(); - - // 强制刷新滚动条显示 - if (hotContainer.value) { - const wtHolder = hotContainer.value.querySelector('.ht_master .wtHolder') as HTMLElement; - if (wtHolder) { - wtHolder.style.overflow = 'hidden'; - setTimeout(() => { - wtHolder.style.overflow = 'auto'; - }, 10); - } - } } }, 50); }; @@ -1086,21 +1075,9 @@ if (hotInstance) { hotInstance.refreshDimensions(); - // 强制重新计算滚动区域 setTimeout(() => { if (hotInstance) { - // 尝试强制更新滚动条 - const container = hotContainer.value; - if (container) { - const wtHolder = container.querySelector('.ht_master .wtHolder') as HTMLElement; - if (wtHolder) { - // 强制重新计算滚动区域大小 - wtHolder.style.overflow = 'hidden'; - setTimeout(() => { - wtHolder.style.overflow = 'auto'; - }, 10); - } - } + hotInstance.refreshDimensions(); } }, 100); } @@ -1194,24 +1171,12 @@ } dimensionRefreshTimer = window.setInterval(() => { if (hotInstance && hotContainer.value) { - // 检查容器是否可见 const rect = hotContainer.value.getBoundingClientRect(); if (rect.width > 0 && rect.height > 0) { hotInstance.refreshDimensions(); - - // 额外强制刷新滚动条 - const wtHolder = hotContainer.value.querySelector('.ht_master .wtHolder') as HTMLElement; - if (wtHolder) { - // 临时隐藏再显示,强制浏览器重新计算滚动条 - const originalOverflow = wtHolder.style.overflow; - wtHolder.style.overflow = 'hidden'; - setTimeout(() => { - wtHolder.style.overflow = originalOverflow || 'auto'; - }, 10); - } } } - }, 1000); // 每秒刷新一次 + }, 1000); }; // 停止定期刷新 @@ -1229,7 +1194,11 @@ resizeObserver = new ResizeObserver((entries) => { const entry = entries[0]; if (entry && hotInstance && entry.contentRect.height > 0) { - hotInstance.updateSettings({ height: entry.contentRect.height }); + const h = Math.floor(entry.contentRect.height); + hotInstance.updateSettings({ height: h }); + nextTick(() => { + hotInstance?.refreshDimensions(); + }); } }); resizeObserver.observe(containerRef.value); @@ -1307,18 +1276,26 @@ + diff --git a/src/router/dynamicRouter.ts b/src/router/dynamicRouter.ts index cc319dd..74ec5ae 100644 --- a/src/router/dynamicRouter.ts +++ b/src/router/dynamicRouter.ts @@ -9,12 +9,6 @@ const HOME_URL = '/home/workplace'; // 默认首页路径 // 引入 views 文件夹下所有 vue 文件 const modules = import.meta.glob('@/views/**/*.vue'); -// 调试:输出模块键的格式(仅在开发环境) -if (import.meta.env.DEV && Object.keys(modules).length > 0) { - const sampleKeys = Object.keys(modules).slice(0, 5); - console.log('import.meta.glob 生成的键格式示例:', sampleKeys); -} - // 存储已添加的动态路由名称,用于清除 let addedDynamicRouteNames: Set = new Set(); @@ -58,11 +52,8 @@ export const initDynamicRouter = async () => { let chooseModule = userStore.chooseModuleGet; // 获取当前选择模块 let homePath: string = HOME_URL; // 首页路径 - console.log('初始化动态路由,选择的模块ID:', chooseModule); - // 如果没有选择模块,尝试使用默认值(RBAC系统可能不需要模块,但为了兼容性使用默认值) if (!chooseModule) { - console.warn('未选择模块,尝试使用默认模块ID: 1'); chooseModule = 1; // 使用默认模块ID // 注意:这里不设置到 userStore,因为可能用户确实没有选择模块 // 如果后续需要,可以在这里设置:userStore.setModule(1); @@ -70,9 +61,7 @@ export const initDynamicRouter = async () => { // 1.获取菜单列表 && 按钮权限列表(强制刷新,不使用缓存) try { - console.log('开始获取菜单列表,模块ID:', chooseModule); await authStore.getAuthMenuList(chooseModule, true); - console.log('菜单列表获取成功,菜单数量:', authStore.authMenuListGet.length); } catch (menuError: any) { console.error('获取菜单列表失败:', menuError); const errorMsg = menuError?.response?.data?.msg || menuError?.message || '获取菜单列表失败'; @@ -117,10 +106,11 @@ export const initDynamicRouter = async () => { // 这里统一处理,避免出现重复前缀 let componentPath = routeItem.component; - // 去掉开头的 @/ 或 /src/ - componentPath = componentPath.replace(/^@\/views\//, '').replace(/^\/src\/views\//, ''); - // 如果还带有 'views/' 前缀,也去掉一次 - componentPath = componentPath.replace(/^views\//, ''); + // 去掉开头的 @/、/src/、views/(兼容 /views/xxx) + componentPath = componentPath + .replace(/^@\/views\//, '') + .replace(/^\/src\/views\//, '') + .replace(/^\/?views\//, ''); // 去掉 .vue 后缀(如果有) componentPath = componentPath.replace(/\.vue$/, ''); @@ -198,29 +188,16 @@ export const initDynamicRouter = async () => { if (matchingKey) { foundComponent = modules[matchingKey]; - console.log(`使用模糊匹配找到组件: ${matchingKey} (原始路径: ${routeItem.component})`); } } if (foundComponent) { routeItem.component = foundComponent; } else { - // 如果还是找不到,输出详细的调试信息 - console.warn(`找不到组件: 原始路径=${routeItem.component}, 处理后路径=${componentPath}`); - console.warn('尝试的路径:', possiblePaths); - - // 列出所有可用的模块键(仅用于调试,限制数量) + // 列出所有可用的模块键(仅用于兜底匹配) const allKeys = Object.keys(modules); if (allKeys.length > 0) { - // 查找相关的键 - const relatedKeys = allKeys.filter(k => - k.toLowerCase().includes(componentPath.toLowerCase().split('/')[0]) - ); - if (relatedKeys.length > 0) { - console.warn('相关的模块路径示例:', relatedKeys.slice(0, 5)); - } - // 输出所有键的格式(仅前10个,用于调试) - console.warn('所有模块键格式示例:', allKeys.slice(0, 10)); + // 保留 allKeys,供下面兜底匹配使用 } // 如果找不到组件,尝试在所有模块键中查找最接近的匹配(不区分大小写) @@ -247,7 +224,6 @@ export const initDynamicRouter = async () => { if (bestMatch) { // 使用找到的匹配(modules[key] 已经是懒加载函数) routeItem.component = modules[bestMatch]; - console.log(`使用最佳匹配找到组件: ${bestMatch} (原始路径: ${routeItem.component})`); } else { // 如果还是找不到,输出错误信息但不设置 component // 让路由使用默认布局或父路由的布局,避免完全失败 diff --git a/src/router/guard/permission.ts b/src/router/guard/permission.ts index a309ea3..208919c 100644 --- a/src/router/guard/permission.ts +++ b/src/router/guard/permission.ts @@ -55,7 +55,6 @@ export default function setupPermissionGuard(router: Router) { // 但 initDynamicRouter 会检查模块,所以我们需要先设置一个默认模块 // 或者修改 initDynamicRouter 来支持没有模块的情况 // 这里先尝试使用默认值 - console.warn('未选择模块,尝试使用默认模块ID: 1'); userStore.setModule(1); } @@ -78,7 +77,6 @@ export default function setupPermissionGuard(router: Router) { const errorMessage = error instanceof Error ? error.message : String(error); if (errorMessage.includes('模块') || errorMessage.includes('请先选择模块')) { // 如果是模块相关的错误,可能需要用户选择模块,暂时允许访问静态路由 - console.warn('动态路由初始化失败(模块问题),允许访问静态路由'); dynamicRouterInitialized = true; // 标记为已初始化,避免重复尝试 // 继续执行后续的路由检查逻辑,不要 return } else { diff --git a/src/store/modules/auth/index.ts b/src/store/modules/auth/index.ts index ab14558..ac4b9c9 100644 --- a/src/store/modules/auth/index.ts +++ b/src/store/modules/auth/index.ts @@ -76,7 +76,6 @@ export const useAuthStore = defineStore({ // 使用 RBAC 系统获取用户菜单 const rbacUserStore = useRbacUserStore(); if (!rbacUserStore.userInfo?.id) { - console.warn('用户未登录,无法获取菜单'); this.authMenuList = []; return; } @@ -86,8 +85,6 @@ export const useAuthStore = defineStore({ // 将菜单树转换为菜单列表格式 const menuList = convertMenuTreeToMenuList(menuTree || []); this.authMenuList = Array.isArray(menuList) ? menuList : []; - console.log('获取到的菜单列表:', this.authMenuList); - console.log('菜单列表长度:', this.authMenuList.length); } catch (error) { console.error('获取菜单列表失败:', error); this.authMenuList = []; diff --git a/src/store/modules/rbac-user.ts b/src/store/modules/rbac-user.ts index 696c49f..0f3beac 100644 --- a/src/store/modules/rbac-user.ts +++ b/src/store/modules/rbac-user.ts @@ -167,7 +167,6 @@ export const useRbacUserStore = defineStore('rbacUser', () => { // 这里需要根据实际 API 响应调整 if (!accessToken.value) { // 临时方案:如果后端还没有返回 token,可能需要等待 API 更新 - console.warn('登录响应中未找到 accessToken,可能需要更新 API') } } diff --git a/src/store/modules/user/index.ts b/src/store/modules/user/index.ts index ae0a716..2272aa2 100644 --- a/src/store/modules/user/index.ts +++ b/src/store/modules/user/index.ts @@ -75,7 +75,6 @@ const useUserStore = defineStore('user', { try { cleanPartial.moduleList = JSON.parse(JSON.stringify(partial.moduleList)); } catch (e) { - console.warn('无法序列化 moduleList,使用原始值'); cleanPartial.moduleList = partial.moduleList; } } diff --git a/src/utils/request.ts b/src/utils/request.ts index c84c10d..ca07f6a 100644 --- a/src/utils/request.ts +++ b/src/utils/request.ts @@ -40,12 +40,6 @@ service.interceptors.request.use( config.headers['Accept-Language'] = 'zh-CN'; - // 调试:如果是菜单添加请求,输出实际发送的数据 - if (config.url?.includes('/sys/limit/menu/add') && config.data) { - console.log('请求拦截器 - 实际发送的数据:', JSON.stringify(config.data, null, 2)); - console.log('请求拦截器 - name 字段:', config.data?.name); - } - return config; }, (error) => { @@ -229,14 +223,12 @@ service.interceptors.response.use( } } else if (error.request) { // 请求已经发出,但没有收到响应 - console.log('网络错误 - 没有收到响应:', error.request); Message.error({ content: '网络连接失败,请检查网络设置', duration: 3000, }); } else { // 请求配置出错 - console.log('请求配置错误:', error.message); Message.error({ content: `请求配置错误: ${error.message}`, duration: 3000, diff --git a/src/views/api/callStatistics/index.vue b/src/views/api/callStatistics/index.vue index 06af67f..7a409f9 100644 --- a/src/views/api/callStatistics/index.vue +++ b/src/views/api/callStatistics/index.vue @@ -5,10 +5,12 @@ import { $baseMessage } from '@/utils'; import HandsontablePro from '@/components/HandsontablePro/index.vue'; import PaginationPro from '@/components/PaginationPro/index.vue'; + import { useTableContainerHeight } from '@/composables/useTableContainerHeight'; defineOptions({ name: 'CallStatistics' }); const activeName = ref('1'); // 1:应用,2:服务商 + const { tableContainerRef, tableHeight } = useTableContainerHeight(); const tabList = [ { key: '1', label: '应用' }, { key: '2', label: '服务商' }, @@ -17,7 +19,7 @@ const tableData = ref([]); const totalCount = ref(0); const currentPage = ref(1); - const pageSize = ref(300); + const pageSize = ref(50); const isLoading = ref(false); const searchParams = reactive({ @@ -76,7 +78,12 @@ PageSize: pageSize.value, }); tableData.value = res?.items || res?.list || res || []; - totalCount.value = res?.totalCount ?? res?.pagination?.total ?? res?.total ?? (Array.isArray(tableData.value) ? tableData.value.length : 0); + totalCount.value = Number( + res?.totalCount ?? + res?.pagination?.total ?? + res?.total ?? + (Array.isArray(tableData.value) ? tableData.value.length : 0) + ); } catch (e) { $baseMessage('加载统计失败', 'error'); tableData.value = []; @@ -169,7 +176,6 @@ :total-count="totalCount" v-model:current-page="currentPage" v-model:page-size="pageSize" - :page-sizes="[300, 500, 1000, 2000]" @page-change="handlePageChange" @page-size-change="handlePageSizeChange" /> @@ -178,7 +184,7 @@ -
+
-
+
@@ -1582,7 +1583,7 @@ {{ item.name }}
-
+
([]); const totalCount = ref(0); const currentPage = ref(1); - const pageSize = ref(300); + const pageSize = ref(50); // 表头搜索参数 const searchParams = reactive({ @@ -52,7 +52,7 @@ }; const res: any = await getLogGetList(params); tableData.value = res?.items || res?.list || res || []; - totalCount.value = res?.totalCount || res?.pagination?.total || res?.length || 0; + totalCount.value = Number(res?.totalCount ?? res?.pagination?.total ?? res?.length ?? 0); } catch (e) { $baseMessage(t('system.log.message.loadFailed'), 'error'); } @@ -416,7 +416,6 @@ :total-count="totalCount" v-model:current-page="currentPage" v-model:page-size="pageSize" - :page-sizes="[300, 500, 1000, 2000]" @page-change="handlePageChange" @page-size-change="handlePageSizeChange" /> diff --git a/src/views/api/upstreamInterface/components/map-service-provider.vue b/src/views/api/upstreamInterface/components/map-service-provider.vue index ac0392f..123d2bc 100644 --- a/src/views/api/upstreamInterface/components/map-service-provider.vue +++ b/src/views/api/upstreamInterface/components/map-service-provider.vue @@ -45,11 +45,14 @@ return row?.interfaceMapId ?? row?.id ?? index; } + function handleSelectRow(row: any, index: number) { + selectedId.value = getRowKey(row, index); + emit('row-click', row); + } + async function loadList() { try { loading.value = true; - // 清空选中状态,避免自动选择第一行 - selectedId.value = null; const requestParams: any = { InterfaceId: props.id, NameOrCode: searchKeyword.value || undefined, @@ -61,7 +64,13 @@ const raw: any = response || {}; const data: any = raw.items ?? raw.data ?? raw.list ?? raw.records ?? raw; list.value = Array.isArray(data) ? data : []; - // 数据加载完成后,不自动选择第一行,保持 selectedId 为 null + // 仅当当前选中项在新列表中不存在时才清空,避免“点击一次又掉选中” + if ( + selectedId.value !== null && + !list.value.some((row: any, index: number) => getRowKey(row, index) === selectedId.value) + ) { + selectedId.value = null; + } } catch (e) { list.value = []; selectedId.value = null; @@ -338,7 +347,7 @@ :key="getRowKey(row, index)" class="provider-item" :class="{ selected: selectedId === getRowKey(row, index) }" - @click="selectedId = getRowKey(row, index); $emit('row-click', row)" + @click="handleSelectRow(row, index)" > @@ -360,7 +369,7 @@ size="small" class="action-btn vertical-dots" :title="t('system.interface.mapping.actions.actions')" - @click="selectedId = getRowKey(row, index); $emit('row-click', row)" + @click="handleSelectRow(row, index)" >
diff --git a/src/views/channel/blacklist/index.vue b/src/views/channel/blacklist/index.vue index 35bdae7..1b78a44 100644 --- a/src/views/channel/blacklist/index.vue +++ b/src/views/channel/blacklist/index.vue @@ -657,7 +657,7 @@ const response = await postForewarningServiceKpiAreaGetKpiAreaInfos(params); const items = response.items || response || []; - totalCount.value = response.totalCount || response.length || 0; + totalCount.value = Number(response.totalCount ?? response.length ?? 0); tableRef.value?.reloadData?.(items); } catch (error) { $baseMessage(t('channel.area.message.loadFailed'), 'error'); diff --git a/src/views/channel/remoteZones/index.vue b/src/views/channel/remoteZones/index.vue index 08db7ee..c4e6a83 100644 --- a/src/views/channel/remoteZones/index.vue +++ b/src/views/channel/remoteZones/index.vue @@ -657,7 +657,7 @@ const response = await postForewarningServiceKpiAreaGetKpiAreaInfos(params); const items = response.items || response || []; - totalCount.value = response.totalCount || response.length || 0; + totalCount.value = Number(response.totalCount ?? response.length ?? 0); tableRef.value?.reloadData?.(items); } catch (error) { $baseMessage(t('channel.area.message.loadFailed'), 'error'); diff --git a/src/views/channel/serviceChannels/index.vue b/src/views/channel/serviceChannels/index.vue index c8b3b17..74b3a25 100644 --- a/src/views/channel/serviceChannels/index.vue +++ b/src/views/channel/serviceChannels/index.vue @@ -1231,7 +1231,6 @@ const formData = reactive({ // 搜索处理 const handleSearch = () => { // TODO: 实现搜索逻辑 - console.log('搜索关键词:', searchKeyword.value) } const appOptions = ref>([]) @@ -1355,7 +1354,6 @@ const loadChannelGroups = async () => { // 如果API返回空数据,保留示例数据用于开发测试 if (channelGroups.value.length === 0) { // 保留示例数据,不覆盖 - console.log('使用示例数据') } } catch (error) { console.error('加载渠道组列表失败:', error) diff --git a/src/views/operation/inboundScan/index.vue b/src/views/operation/inboundScan/index.vue index 1bc9a64..1760d45 100644 --- a/src/views/operation/inboundScan/index.vue +++ b/src/views/operation/inboundScan/index.vue @@ -114,60 +114,28 @@
- {{ $t('track.order.pagination.total', { count: totalCount }) }} - - {{ $t('track.order.pagination.prev') }} - - {{ currentPage }} - - {{ $t('track.order.pagination.next') }} - - - 10 - 20 - 50 - - {{ $t('track.order.pagination.perPage') }} - {{ $t('track.order.pagination.goTo') }} - - {{ $t('track.order.pagination.page') }}
-
- +
+
@@ -179,8 +147,11 @@ import { ref, reactive, computed, onMounted } from 'vue'; import { IconNotification } from '@arco-design/web-vue/es/icon'; import { $baseMessage } from '@/utils'; import HandsontablePro from '@/components/HandsontablePro/index.vue'; +import PaginationPro from '@/components/PaginationPro/index.vue'; +import { useTableContainerHeight } from '@/composables/useTableContainerHeight'; const { t } = useI18n(); +const { tableContainerRef, tableHeight } = useTableContainerHeight(); defineOptions({ name: 'InboundScan', @@ -230,20 +201,13 @@ const handsontableRef = ref>(); const currentPage = ref(1); const pageSize = ref(50); -const jumpPage = ref(1); const totalCount = computed(() => recentOrders.value.length); -const totalPages = computed(() => Math.max(1, Math.ceil(totalCount.value / pageSize.value))); const displayedData = computed(() => { const start = (currentPage.value - 1) * pageSize.value; return recentOrders.value.slice(start, start + pageSize.value); }); -const TABLE_ROW_HEIGHT = 32; -const TABLE_HEADER_HEIGHT = 40; -const tableScrollHeight = computed( - () => TABLE_HEADER_HEIGHT + pageSize.value * TABLE_ROW_HEIGHT -); function buildFakeList(len: number) { const products = ['产品1', '产品2', '产品3']; @@ -270,21 +234,11 @@ function buildFakeList(len: number) { function handlePageChange(page: number) { currentPage.value = page; - jumpPage.value = page; } -function handlePageSizeChange() { +function handlePageSizeChange(size: number) { + pageSize.value = size; currentPage.value = 1; - jumpPage.value = 1; -} - -function handleJumpPage() { - const page = Number(jumpPage.value); - if (page >= 1 && page <= totalPages.value) { - currentPage.value = page; - } else { - $baseMessage(t('operation.printLabel.pagination.invalidPage'), 'warning'); - } } // 处理扫描 @@ -342,7 +296,6 @@ function handleReset() { onMounted(() => { recentOrders.value = buildFakeList(50); - jumpPage.value = 1; }); @@ -350,8 +303,10 @@ onMounted(() => { .waybill-container { padding: 24px; background-color: #f5f5f5; - height: 100vh; - overflow: hidden; + min-height: 100vh; + height: auto; + overflow-x: hidden; + overflow-y: auto; display: flex; flex-direction: column; } @@ -496,8 +451,7 @@ onMounted(() => { border-radius: 8px; padding: 24px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); - flex: 1; - min-height: 0; + flex: 0 0 auto; display: flex; flex-direction: column; @@ -536,12 +490,14 @@ onMounted(() => { } } - .table-scroll-wrap { - flex: 1; + // Handsontable 列表区固定高度,父级 flex 链供 HandsontablePro 撑满 + .list-wrap { + flex: 0 0 auto; + height: 850px; min-height: 0; - overflow: auto; - border: 1px solid #e5e6eb; - border-radius: 4px; + display: flex; + flex-direction: column; + overflow: hidden; } } diff --git a/src/views/operation/outboundScan/index.vue b/src/views/operation/outboundScan/index.vue index 243e65e..0b51169 100644 --- a/src/views/operation/outboundScan/index.vue +++ b/src/views/operation/outboundScan/index.vue @@ -43,60 +43,28 @@
- {{ $t('track.order.pagination.total', { count: totalCount }) }} - - {{ $t('track.order.pagination.prev') }} - - {{ currentPage }} - - {{ $t('track.order.pagination.next') }} - - - 10 - 20 - 50 - - {{ $t('track.order.pagination.perPage') }} - {{ $t('track.order.pagination.goTo') }} - - {{ $t('track.order.pagination.page') }}
-
- +
+
@@ -108,8 +76,11 @@ import { ref, reactive, computed, onMounted } from 'vue'; import { IconNotification } from '@arco-design/web-vue/es/icon'; import { $baseMessage } from '@/utils'; import HandsontablePro from '@/components/HandsontablePro/index.vue'; +import PaginationPro from '@/components/PaginationPro/index.vue'; +import { useTableContainerHeight } from '@/composables/useTableContainerHeight'; const { t } = useI18n(); +const { tableContainerRef, tableHeight } = useTableContainerHeight(); defineOptions({ name: 'OutboundScan', @@ -134,20 +105,13 @@ const handsontableRef = ref>(); const currentPage = ref(1); const pageSize = ref(50); -const jumpPage = ref(1); const totalCount = computed(() => recentOrders.value.length); -const totalPages = computed(() => Math.max(1, Math.ceil(totalCount.value / pageSize.value))); const displayedData = computed(() => { const start = (currentPage.value - 1) * pageSize.value; return recentOrders.value.slice(start, start + pageSize.value); }); -const TABLE_ROW_HEIGHT = 32; -const TABLE_HEADER_HEIGHT = 40; -const tableScrollHeight = computed( - () => TABLE_HEADER_HEIGHT + pageSize.value * TABLE_ROW_HEIGHT -); function buildFakeList(len: number) { const warehouses = ['北京仓', '上海仓', '广州仓', '深圳仓', '成都仓']; @@ -168,21 +132,11 @@ function buildFakeList(len: number) { function handlePageChange(page: number) { currentPage.value = page; - jumpPage.value = page; } -function handlePageSizeChange() { +function handlePageSizeChange(size: number) { + pageSize.value = size; currentPage.value = 1; - jumpPage.value = 1; -} - -function handleJumpPage() { - const page = Number(jumpPage.value); - if (page >= 1 && page <= totalPages.value) { - currentPage.value = page; - } else { - $baseMessage(t('operation.printLabel.pagination.invalidPage'), 'warning'); - } } // 处理扫描 @@ -228,7 +182,6 @@ function handleReset() { onMounted(() => { recentOrders.value = buildFakeList(50); - jumpPage.value = 1; }); @@ -236,8 +189,10 @@ onMounted(() => { .waybill-container { padding: 24px; background-color: #f5f5f5; - height: 100vh; - overflow: hidden; + min-height: 100vh; + height: auto; + overflow-x: hidden; + overflow-y: auto; display: flex; flex-direction: column; } @@ -320,8 +275,7 @@ onMounted(() => { border-radius: 8px; padding: 24px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); - flex: 1; - min-height: 0; + flex: 0 0 auto; display: flex; flex-direction: column; @@ -360,12 +314,13 @@ onMounted(() => { } } - .table-scroll-wrap { - flex: 1; + .list-wrap { + flex: 0 0 auto; + height: 850px; min-height: 0; - overflow: auto; - border: 1px solid #e5e6eb; - border-radius: 4px; + display: flex; + flex-direction: column; + overflow: hidden; } } diff --git a/src/views/operation/printLabel/index.vue b/src/views/operation/printLabel/index.vue index 8799f8e..7f554c7 100644 --- a/src/views/operation/printLabel/index.vue +++ b/src/views/operation/printLabel/index.vue @@ -90,60 +90,28 @@
- {{ $t('track.order.pagination.total', { count: totalCount }) }} - - {{ $t('track.order.pagination.prev') }} - - {{ currentPage }} - - {{ $t('track.order.pagination.next') }} - - - 10 - 20 - 50 - - {{ $t('track.order.pagination.perPage') }} - {{ $t('track.order.pagination.goTo') }} - - {{ $t('track.order.pagination.page') }}
-
- +
+
@@ -155,8 +123,11 @@ import { ref, reactive, computed, onMounted } from 'vue'; import { IconNotification } from '@arco-design/web-vue/es/icon'; import { $baseMessage } from '@/utils'; import HandsontablePro from '@/components/HandsontablePro/index.vue'; +import PaginationPro from '@/components/PaginationPro/index.vue'; +import { useTableContainerHeight } from '@/composables/useTableContainerHeight'; const { t } = useI18n(); +const { tableContainerRef, tableHeight } = useTableContainerHeight(); defineOptions({ name: 'PrintLabel', @@ -253,9 +224,7 @@ const handsontableRef = ref>(); // 分页:当前页、每页条数、总条数、跳转页 const currentPage = ref(1); const pageSize = ref(50); -const jumpPage = ref(1); const totalCount = computed(() => recentOrders.value.length); -const totalPages = computed(() => Math.max(1, Math.ceil(totalCount.value / pageSize.value))); // 当前页展示的数据(保证显示到 50 条时可滚动) const displayedData = computed(() => { @@ -264,34 +233,18 @@ const displayedData = computed(() => { }); // 表格滚动高度:表头 + 当前页行数 * 行高,确保 50 条时能全部通过滚动看到 -const TABLE_ROW_HEIGHT = 32; -const TABLE_HEADER_HEIGHT = 40; -const tableScrollHeight = computed( - () => TABLE_HEADER_HEIGHT + pageSize.value * TABLE_ROW_HEIGHT -); function handlePageChange(page: number) { currentPage.value = page; - jumpPage.value = page; } -function handlePageSizeChange() { +function handlePageSizeChange(size: number) { + pageSize.value = size; currentPage.value = 1; - jumpPage.value = 1; -} - -function handleJumpPage() { - const page = Number(jumpPage.value); - if (page >= 1 && page <= totalPages.value) { - currentPage.value = page; - } else { - $baseMessage(t('operation.printLabel.pagination.invalidPage'), 'warning'); - } } onMounted(() => { recentOrders.value = buildFakeList(50); - jumpPage.value = 1; }); // 处理扫描 @@ -349,8 +302,10 @@ function handleReset() { .waybill-container { padding: 24px; background-color: #f5f5f5; - height: 100vh; - overflow: hidden; + min-height: 100vh; + height: auto; + overflow-x: hidden; + overflow-y: auto; display: flex; flex-direction: column; } @@ -447,8 +402,7 @@ function handleReset() { border-radius: 8px; padding: 24px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); - flex: 1; - min-height: 0; + flex: 0 0 auto; display: flex; flex-direction: column; @@ -487,12 +441,13 @@ function handleReset() { } } - .table-scroll-wrap { - flex: 1; + .list-wrap { + flex: 0 0 auto; + height: 850px; min-height: 0; - overflow: auto; - border: 1px solid #e5e6eb; - border-radius: 4px; + display: flex; + flex-direction: column; + overflow: hidden; } } diff --git a/src/views/order/myOrders/index.vue b/src/views/order/myOrders/index.vue index c34ebaa..443fd16 100644 --- a/src/views/order/myOrders/index.vue +++ b/src/views/order/myOrders/index.vue @@ -3,6 +3,7 @@ import { IconSettings } from '@arco-design/web-vue/es/icon'; import HandsontablePro from '@/components/HandsontablePro/index.vue'; import PaginationPro from '@/components/PaginationPro/index.vue'; + import { useTableContainerHeight } from '@/composables/useTableContainerHeight'; import { useI18n } from 'vue-i18n'; import dayjs from 'dayjs'; import OrderDetailDrawer from './components/OrderDetailDrawer.vue'; @@ -12,6 +13,7 @@ }); const { t } = useI18n(); + const { tableContainerRef, tableHeight } = useTableContainerHeight(); // 订单详情抽屉 const detailDrawerRef = ref>(); @@ -46,7 +48,7 @@ // 分页相关数据 const currentPage = ref(1); - const pageSize = ref(20); + const pageSize = ref(50); const totalCount = ref(20); // 生成模拟订单数据 @@ -482,7 +484,6 @@ :total-count="totalCount" v-model:current-page="currentPage" v-model:page-size="pageSize" - :page-sizes="[20, 50, 100, 200]" @page-change="handlePageChange" @page-size-change="handlePageSizeChange" /> @@ -490,7 +491,7 @@ -
+
@@ -521,8 +523,12 @@ .my-orders-container { padding: 16px; background-color: #f0f3f4; - height: 100vh; - overflow: hidden; + min-height: 100vh; + height: auto; + overflow-x: hidden; + overflow-y: auto; + display: flex; + flex-direction: column; } .page-header { @@ -545,6 +551,7 @@ display: flex; justify-content: space-between; align-items: center; + flex-shrink: 0; } .tabs-container { @@ -776,6 +783,9 @@ border-radius: 8px; padding: 16px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08); + flex: 0 0 auto; + display: flex; + flex-direction: column; } .table-toolbar { @@ -807,12 +817,15 @@ } } - .handsontable-container { + .list-wrap { width: 100%; - border: 0.5px solid #f0f0f0 !important; - border-radius: 8px; overflow: hidden; - + flex: 0 0 auto; + height: 1150px; + min-height: 0; + display: flex; + flex-direction: column; + .handsontable-wrapper { width: 100%; diff --git a/src/views/order/priceCheck/index.vue b/src/views/order/priceCheck/index.vue index d784bcd..ef5b25e 100644 --- a/src/views/order/priceCheck/index.vue +++ b/src/views/order/priceCheck/index.vue @@ -1,19 +1,21 @@ \ No newline at end of file + diff --git a/src/views/order/priceCheck/mockPriceResults.ts b/src/views/order/priceCheck/mockPriceResults.ts new file mode 100644 index 0000000..77829f8 --- /dev/null +++ b/src/views/order/priceCheck/mockPriceResults.ts @@ -0,0 +1,256 @@ +/** 试算结果模拟数据(接口接入后可删除) */ +export interface PriceCheckRowRaw { + id: number; + shippingMethod: string; + warehouse: string; + deliveryTime: string; + volumetricWeight: string; + chargeableWeight: string; + costFormula: string; + freight: string; + otherFees: string; + totalCost: string; +} + +export const mockPriceResults: PriceCheckRowRaw[] = [ + { + id: 1, + shippingMethod: '美国空运专线(普货)', + warehouse: '一代深圳仓', + deliveryTime: '3-7', + volumetricWeight: '2', + chargeableWeight: '2', + costFormula: '(62*2) +5+7', + freight: '62', + otherFees: '5', + totalCost: '136', + }, + { + id: 2, + shippingMethod: '美国空运特惠专线898(普货)', + warehouse: '壹号华南仓', + deliveryTime: '2-8', + volumetricWeight: '2', + chargeableWeight: '2', + costFormula: '(62*2) +7', + freight: '62', + otherFees: '-', + totalCost: '131', + }, + { + id: 3, + shippingMethod: '美国海运专线(普货)', + warehouse: '深圳盐田仓', + deliveryTime: '15-25', + volumetricWeight: '3', + chargeableWeight: '3', + costFormula: '(25*3) +10+15', + freight: '25', + otherFees: '10', + totalCost: '100', + }, + { + id: 4, + shippingMethod: '美国快递专线(普货)', + warehouse: '广州白云仓', + deliveryTime: '5-10', + volumetricWeight: '1.5', + chargeableWeight: '2', + costFormula: '(85*2) +8', + freight: '85', + otherFees: '8', + totalCost: '178', + }, + { + id: 5, + shippingMethod: '美国经济专线(普货)', + warehouse: '东莞虎门仓', + deliveryTime: '8-15', + volumetricWeight: '2.5', + chargeableWeight: '3', + costFormula: '(45*3) +12+6', + freight: '45', + otherFees: '12', + totalCost: '153', + }, + { + id: 6, + shippingMethod: '美国特快专线(普货)', + warehouse: '上海浦东仓', + deliveryTime: '2-5', + volumetricWeight: '1.8', + chargeableWeight: '2', + costFormula: '(95*2) +15+20', + freight: '95', + otherFees: '15', + totalCost: '225', + }, + { + id: 7, + shippingMethod: '美国陆运专线(普货)', + warehouse: '深圳龙岗仓', + deliveryTime: '12-20', + volumetricWeight: '4', + chargeableWeight: '4', + costFormula: '(30*4) +18+8', + freight: '30', + otherFees: '18', + totalCost: '146', + }, + { + id: 8, + shippingMethod: '美国拼箱专线(普货)', + warehouse: '宁波舟山仓', + deliveryTime: '18-30', + volumetricWeight: '5', + chargeableWeight: '5', + costFormula: '(20*5) +25+12', + freight: '20', + otherFees: '25', + totalCost: '137', + }, + { + id: 9, + shippingMethod: '英国空运专线(普货)', + warehouse: '深圳宝安仓', + deliveryTime: '4-8', + volumetricWeight: '2.2', + chargeableWeight: '2.5', + costFormula: '(68*2.5) +8+10', + freight: '68', + otherFees: '8', + totalCost: '188', + }, + { + id: 10, + shippingMethod: '德国空运专线(普货)', + warehouse: '上海虹桥仓', + deliveryTime: '5-9', + volumetricWeight: '1.8', + chargeableWeight: '2', + costFormula: '(72*2) +12+15', + freight: '72', + otherFees: '12', + totalCost: '171', + }, + { + id: 11, + shippingMethod: '法国海运专线(普货)', + warehouse: '青岛港仓', + deliveryTime: '20-35', + volumetricWeight: '4.5', + chargeableWeight: '5', + costFormula: '(28*5) +20+18', + freight: '28', + otherFees: '20', + totalCost: '178', + }, + { + id: 12, + shippingMethod: '日本空运专线(普货)', + warehouse: '大连港仓', + deliveryTime: '2-5', + volumetricWeight: '1.2', + chargeableWeight: '1.5', + costFormula: '(55*1.5) +5+6', + freight: '55', + otherFees: '5', + totalCost: '93.5', + }, + { + id: 13, + shippingMethod: '加拿大空运专线(普货)', + warehouse: '北京首都仓', + deliveryTime: '6-12', + volumetricWeight: '2.8', + chargeableWeight: '3', + costFormula: '(75*3) +15+20', + freight: '75', + otherFees: '15', + totalCost: '260', + }, + { + id: 14, + shippingMethod: '澳大利亚海运专线(普货)', + warehouse: '天津港仓', + deliveryTime: '25-40', + volumetricWeight: '6', + chargeableWeight: '6', + costFormula: '(22*6) +30+25', + freight: '22', + otherFees: '30', + totalCost: '217', + }, + { + id: 15, + shippingMethod: '美国空运特快专线(敏感货)', + warehouse: '一代深圳仓', + deliveryTime: '1-3', + volumetricWeight: '1.5', + chargeableWeight: '2', + costFormula: '(120*2) +25+30', + freight: '120', + otherFees: '25', + totalCost: '295', + }, + { + id: 16, + shippingMethod: '欧洲铁路专线(普货)', + warehouse: '西安陆港仓', + deliveryTime: '18-25', + volumetricWeight: '5.5', + chargeableWeight: '6', + costFormula: '(18*6) +22+15', + freight: '18', + otherFees: '22', + totalCost: '169', + }, + { + id: 17, + shippingMethod: '美国空运经济专线(普货)', + warehouse: '成都双流仓', + deliveryTime: '10-18', + volumetricWeight: '3.2', + chargeableWeight: '3.5', + costFormula: '(50*3.5) +10+8', + freight: '50', + otherFees: '10', + totalCost: '193', + }, + { + id: 18, + shippingMethod: '英国海运专线(普货)', + warehouse: '厦门港仓', + deliveryTime: '22-38', + volumetricWeight: '7', + chargeableWeight: '7', + costFormula: '(24*7) +35+28', + freight: '24', + otherFees: '35', + totalCost: '261', + }, + { + id: 19, + shippingMethod: '德国快递专线(普货)', + warehouse: '杭州萧山仓', + deliveryTime: '3-7', + volumetricWeight: '1.6', + chargeableWeight: '2', + costFormula: '(88*2) +10+12', + freight: '88', + otherFees: '10', + totalCost: '198', + }, + { + id: 20, + shippingMethod: '美国空运标准专线(普货)', + warehouse: '一代深圳仓', + deliveryTime: '5-10', + volumetricWeight: '2.3', + chargeableWeight: '2.5', + costFormula: '(58*2.5) +6+9', + freight: '58', + otherFees: '6', + totalCost: '160', + }, +]; diff --git a/src/views/system/organization/index.vue b/src/views/system/organization/index.vue index 339a988..7a368b5 100644 --- a/src/views/system/organization/index.vue +++ b/src/views/system/organization/index.vue @@ -1,5 +1,6 @@ +
.organization-page { - padding: 24px; + width: 100%; + box-sizing: border-box; + padding: 16px; + background-color: #f0f3f4; + min-height: 100vh; + height: auto; + overflow-x: hidden; + overflow-y: auto; +} + +.organization-page-card { background: #fff; border-radius: 8px; + padding: 16px; + box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08); + box-sizing: border-box; } .page-header { display: flex; justify-content: space-between; + align-items: center; margin-bottom: 16px; + flex-shrink: 0; + gap: 12px; } .action-buttons { diff --git a/src/views/system/organization/user/index.vue b/src/views/system/organization/user/index.vue index 9e8959a..6f80250 100644 --- a/src/views/system/organization/user/index.vue +++ b/src/views/system/organization/user/index.vue @@ -1,5 +1,6 @@ {{ t('system.user.actions.add') }} - - - {{ t('system.user.actions.batchDelete') }} - @@ -39,78 +31,36 @@ +
- - - - - - - - - - - +
+ +
+ ([]) const searchKeyword = ref('') const filterOrganizationId = ref() -const selectedRowKeys = ref([]) const organizationTree = ref([]) +const handsontableRef = ref>() +const { tableContainerRef, tableHeight } = useTableContainerHeight() +const handsontableHeight = computed(() => Math.max(tableHeight.value || 0, 400)) // 转换组织数据为 tree-select 需要的格式 const organizationTreeData = computed(() => { @@ -250,23 +201,74 @@ const pagination = reactive({ showTotal: true, }) -const columns = computed(() => [ - { title: t('system.user.table.avatar'), slotName: 'avatar', width: 80, fixed: 'left' }, - { title: t('system.user.table.realName'), dataIndex: 'name', width: 120 }, - { title: t('system.user.table.account'), dataIndex: 'account', width: 120 }, - { title: t('system.user.table.email'), dataIndex: 'email', width: 200 }, - { title: t('system.user.table.orgName'), slotName: 'organizationName', width: 150 }, - { title: t('system.user.table.roles'), slotName: 'roles', width: 200 }, - { title: t('system.user.table.createTime'), slotName: 'createdAt', width: 180 }, - { title: t('system.user.table.actions'), slotName: 'action', width: 250, fixed: 'right' }, +const hotColumns = computed(() => [ + { key: 'avatar', label: t('system.user.table.avatar'), width: 80 }, + { key: 'name', label: t('system.user.table.realName'), width: 120 }, + { key: 'account', label: t('system.user.table.account'), width: 120 }, + { key: 'email', label: t('system.user.table.email'), width: 200 }, + { key: 'organizationName', label: t('system.user.table.orgName'), width: 150 }, + { key: 'roles', label: t('system.user.table.roles'), width: 220 }, + { key: 'createdAt', label: t('system.user.table.createTime'), width: 180 }, ]) -const rowSelection = computed(() => ({ - selectedRowKeys: selectedRowKeys.value, - onChange: (keys: string[]) => { - selectedRowKeys.value = keys - }, -})) +const actionEditIcon = '' +const actionAssignIcon = '' +const actionDeleteIcon = '' + +function customCellRenderer(_row: number, col: number, _value: any, rowData: UserDto): string | null { + const dataColIndex = col - 1 + if (dataColIndex < 0 || dataColIndex >= hotColumns.value.length) return null + const key = hotColumns.value[dataColIndex].key + + if (key === 'avatar') { + const avatarUrl = rowData?.avatar + if (!avatarUrl) return '--' + return `` + } + if (key === 'organizationName') { + return rowData?.organizationName || '--' + } + if (key === 'roles') { + const roleNames = (rowData?.roles || []).map((r) => r.name).filter(Boolean) + if (!roleNames.length) return '--' + return roleNames.map((name) => `${name}`).join('') + } + if (key === 'createdAt') { + return rowData?.createdAt ? dayjs(rowData.createdAt).format('YYYY-MM-DD HH:mm:ss') : '--' + } + return null +} + +function actionRenderer(_row: UserDto, rowIndex: number): string { + const actions: string[] = [] + if (hasPermission('Rbac.Users.Update')) { + actions.push(`${actionEditIcon}`) + } + if (hasPermission('Rbac.Users.AssignRoles')) { + actions.push(`${actionAssignIcon}`) + } + if (hasPermission('Rbac.Users.Delete')) { + actions.push(`${actionDeleteIcon}`) + } + return `
${actions.join('')}
` +} + +function handleActionClick(row: UserDto, _rowIndex: number, action?: string) { + if (action === 'edit') { + handleEdit(row) + return + } + if (action === 'assignRoles') { + handleAssignRoles(row) + return + } + if (action === 'delete') { + Modal.confirm({ + content: t('system.user.modal.deleteConfirmContent', { count: 1 }), + onOk: () => handleDelete(row.id), + }) + } +} // 表单相关 const modalVisible = ref(false) @@ -421,29 +423,6 @@ async function handleDelete(id: string | undefined) { } } -// 批量删除 -async function handleBatchDelete() { - if (!selectedRowKeys.value.length) { - Message.warning(t('system.user.message.selectUsersToDelete')) - return - } - - Modal.confirm({ - title: t('system.user.modal.deleteConfirmTitle'), - content: t('system.user.modal.deleteConfirmContent', { count: selectedRowKeys.value.length }), - onOk: async () => { - try { - await UserService.deleteRbacUserDeleteBatch(selectedRowKeys.value) - Message.success(t('common.deleteSuccess')) - selectedRowKeys.value = [] - loadData() - } catch (error) { - handleApiError(error) - } - }, - }) -} - // 提交表单 async function handleModalOk() { try { @@ -541,15 +520,51 @@ async function loadOrganizations() { diff --git a/src/views/track/trackFlag/index.vue b/src/views/track/trackFlag/index.vue index ec290c0..adefa60 100644 --- a/src/views/track/trackFlag/index.vue +++ b/src/views/track/trackFlag/index.vue @@ -11,9 +11,12 @@ import { getAppGetList } from '@/api/ApplicationServices/apps'; import PaginationPro from '@/components/PaginationPro/index.vue'; import HandsontablePro from '@/components/HandsontablePro/index.vue'; + import { useTableContainerHeight } from '@/composables/useTableContainerHeight'; import { IconSearch } from '@arco-design/web-vue/es/icon'; const { t } = useI18n(); + const { tableContainerRef, tableHeight } = useTableContainerHeight(); + const handsontableHeight = computed(() => Math.max(tableHeight.value || 0, 400)); type IDialogConfig = { show: boolean; @@ -34,7 +37,7 @@ const tableData = ref([]); const totalCount = ref(0); const currentPage = ref(1); - const pageSize = ref(30); + const pageSize = ref(50); const appMap = ref>({}); @@ -117,7 +120,7 @@ pageIndex: currentPage.value, pageSize: pageSize.value, }) as API.GetTrackFlagListDtoPagedResult; - totalCount.value = res?.totalCount || 0; + totalCount.value = Number(res?.totalCount ?? 0); const items = res?.items || []; tableData.value = items.map((item: any) => ({ ...item, @@ -295,7 +298,8 @@