This commit is contained in:
biybuy 2026-03-23 10:00:44 +08:00
parent 6f03cd63b5
commit dc801a0ba1
65 changed files with 1382 additions and 1692 deletions

View File

@ -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');
// 模拟后端返回的接口数据

View File

@ -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 = [
// 一级菜单 - 首页

View File

@ -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');

View File

@ -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' \\

View File

@ -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)

View File

@ -8,7 +8,6 @@ export async function postInterfaceServiceProviderInterfacePaginatedList(
body: any,
options?: { [key: string]: any }
) {
console.warn('postInterfaceServiceProviderInterfacePaginatedList 是临时占位函数,需要实现真实的API');
return request<any>(`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<boolean>(`api/Interface/BatchDeleteInterfaceByIds`, {
method: 'POST',
headers: {

View File

@ -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

View File

@ -117,7 +117,7 @@ export class CancelablePromise<T> implements Promise<T> {
cancelHandler();
}
} catch (error) {
console.warn('Cancellation threw an error', error);
console.error('Cancellation threw an error', error);
return;
}
}

View File

@ -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 @@
</template>
<style scoped lang="less">
.handsontable-pro-container {
display: flex;
flex-direction: column;
width: 100%;
height: 100%;
border: 0.5px solid #f0f0f0 !important;
border-radius: 4px;
overflow: hidden;
overflow: hidden; // 不出现外层滚动条;滚动仅发生在 Handsontable .ht_master .wtHolder
flex: 1;
min-height: 0;
box-sizing: border-box;
.handsontable-wrapper {
flex: 1;
min-height: 0;
width: 100%;
height: 100%;
position: relative;
:deep(.handsontable) {
height: 100%;
min-height: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
border: none !important;

View File

@ -1199,7 +1199,7 @@
return processed;
} catch (error) {
console.warn('processInParamsData 处理失败:', error);
console.error('processInParamsData 处理失败:', error);
// 如果处理失败,返回原始数据
return inParams;
}

View File

@ -103,18 +103,12 @@
[props.infoApiIdKey]: data[props.infoApiIdKey],
...restApiParams,
};
console.log('调用详情接口,参数:', requestParams);
const res = await dataApi(requestParams);
console.log('详情接口原始响应:', res);
console.log('响应类型:', typeof res);
console.log('响应是否为数组:', Array.isArray(res));
console.log('响应是否包含 data:', res && typeof res === 'object' && 'data' in res);
// request.ts 已经处理了响应格式,如果响应是 { code: 200, data: {...} },会直接返回 data
// 所以这里直接使用 res 即可
let formData = res?.data || res;
console.log('处理后的 formData:', formData);
// 如果 formData 是 null 或 undefined,使用空对象
if (!formData || typeof formData !== 'object') {
@ -126,8 +120,6 @@
formData.appKey = formData.app;
}
console.log('获取详情返回数据:', formData);
emit('on-getinfo', formData);
// 等待表单完全初始化,确保表单引用已准备好
@ -139,8 +131,6 @@
formRefInstance.formRef.setFormValue(formData);
} else if (formRefInstance?.setFormValue) {
formRefInstance.setFormValue(formData);
} else {
console.warn('表单引用未准备好,无法设置表单值');
}
} catch (error: any) {
console.error('获取详情失败:', error);
@ -148,14 +138,11 @@
}
} else if (data[props.initFormData]) {
const initFormData = data[props.initFormData];
console.log(initFormData, 'initFormData');
unref(formRef)?.setFormValue(initFormData);
}
}
function setFormValue(data) {
console.log(data, 'data');
unref(formRef)?.setFormValue(data);
}
@ -187,7 +174,6 @@
const valid = await unref(formRef)?.validate();
if (valid) return;
const formValue = await unref(formRef)?.getValues();
console.log(formValue, 'formValue');
// 清理表单数据,避免空字符串传递给API
let cleanedFormValue = cleanFormData(formValue);
@ -243,7 +229,7 @@
emit('on-submit', { ...form });
}
} catch (error) {
console.log(error, 'error');
console.error(error);
}
}

View File

@ -11,7 +11,8 @@
pageSizes?: number[];
}>(),
{
pageSizes: () => [10, 30, 50, 100],
pageSize: 50,
pageSizes: () => [50, 100, 300, 500, 1000, 2000, 5000],
}
);
@ -60,18 +61,20 @@
type="text"
size="small"
:disabled="props.currentPage <= 1"
:aria-label="t('common.pagination.prev')"
@click="handlePageChange(props.currentPage - 1)"
>
{{ t('common.pagination.prev') }}
‹
</a-button>
<span class="current-page">{{ props.currentPage }}</span>
<a-button
type="text"
size="small"
:disabled="props.currentPage >= maxPage"
:aria-label="t('common.pagination.next')"
@click="handlePageChange(props.currentPage + 1)"
>
{{ t('common.pagination.next') }}
›
</a-button>
<a-select
:model-value="props.pageSize"

View File

@ -47,7 +47,6 @@
emitsValue();
}
function blurFn() {
console.log('click outside');
input1.value = input2.value.replace(/\n/g, ',');
// input2.value = ''
display.value = 'hidden';

View File

@ -185,30 +185,20 @@
pageIndex: tablePage.currentPage,
pageSize: pageSize,
});
console.log('TablePro getData 接收到的数据:', d);
if (d) {
if (props.showPager) {
tablePage.total = Number(d.totalCount) || 0;
const items = d.items || d?.data?.list || [];
console.log('TablePro 准备加载数据到表格:', {
total: tablePage.total,
itemsLength: items?.length,
items: items,
});
const dataArray = Array.isArray(items) ? items : [];
console.log('TablePro 调用 reloadData,数据数组长度:', dataArray.length);
console.log('TablePro reloadData 前的表格数据:', tableRef.value?.getTableData());
if (tableRef.value) {
// 先清空数据,再加载新数据,确保表格更新
tableRef.value.reloadData([]);
nextTick(() => {
tableRef.value.reloadData(dataArray);
console.log('TablePro reloadData 后的表格数据:', tableRef.value?.getTableData());
// 强制刷新表格
nextTick(() => {
console.log('TablePro nextTick 后的表格数据:', tableRef.value?.getTableData());
// 强制触发表格更新
if (tableRef.value && typeof tableRef.value.updateData === 'function') {
tableRef.value.updateData();
@ -229,8 +219,6 @@
if (props.autoHeight) {
proOptions.height = contentHeight.value;
}
} else {
console.warn('TablePro getData 接收到的数据为空');
}
}
};

View File

@ -30,7 +30,6 @@
const mm = Math.floor((time - hh) * 10);
timeZone.hour = hh;
timeZone.minute = mm.toString();
console.log(time, 'time', hh, mm, 'hh.mm-modelvbal');
}
},
{

View File

@ -145,7 +145,6 @@
/** 显示更多 - 站内信功能已移除 */
function toMessage() {
// 站内信功能已移除,不再跳转
console.log('站内信功能已移除');
}
</script>

View File

@ -174,8 +174,7 @@
valueDark: 'dark',
valueLight: 'light',
storageKey: 'arco-theme',
onChanged(dark: boolean) {
console.log(dark);
onChanged() {
// overridden default behavior
// appStore.toggleTheme(dark);
},

View File

@ -111,7 +111,6 @@ const onMessageDropdownVisibleChange = (visible: boolean) => {
// 点击菜单项 - 站内信功能已移除
const onMessageMenuClick = (event: any) => {
// 站内信功能已移除,不再跳转
console.log('站内信功能已移除');
};
onMounted(() => {

View File

@ -38,7 +38,7 @@ export function $baseConfirm({
try {
await onOk?.();
} catch (e) {
console.log(e);
console.error(e);
}
return true;
},

View File

@ -50,7 +50,6 @@ export function useSystemConfig() {
? url
: `/${url}`;
logoUrl.value = finalUrl;
console.log('设置logo URL:', finalUrl);
} else {
logoUrl.value = '/src/assets/logo.png';
}

View File

@ -0,0 +1,50 @@
import { nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue';
export function useTableContainerHeight() {
const tableContainerRef = ref<HTMLElement | null>(null);
const tableHeight = ref(0);
let resizeObserver: ResizeObserver | null = null;
const updateHeight = () => {
tableHeight.value = Math.max(0, tableContainerRef.value?.clientHeight || 0);
};
const observe = (el: HTMLElement | null) => {
if (!resizeObserver || !el) return;
resizeObserver.observe(el);
};
const unobserve = (el: HTMLElement | null) => {
if (!resizeObserver || !el) return;
try {
resizeObserver.unobserve(el);
} catch (_) {}
};
onMounted(() => {
resizeObserver = new ResizeObserver(() => updateHeight());
observe(tableContainerRef.value);
window.addEventListener('resize', updateHeight);
nextTick(updateHeight);
});
watch(tableContainerRef, (nextEl, prevEl) => {
unobserve(prevEl);
observe(nextEl);
nextTick(updateHeight);
});
onBeforeUnmount(() => {
window.removeEventListener('resize', updateHeight);
if (resizeObserver) {
unobserve(tableContainerRef.value);
resizeObserver.disconnect();
resizeObserver = null;
}
});
return {
tableContainerRef,
tableHeight,
};
}

View File

@ -1,9 +1,11 @@
<template>
<router-view v-slot="{ Component, route }">
<keep-alive :include="cacheList">
<component :is="Component" :key="getComponentKey(route)" />
</keep-alive>
</router-view>
<div class="page-layout-root">
<router-view v-slot="{ Component, route }">
<keep-alive :include="cacheList">
<component :is="Component" :key="getComponentKey(route)" />
</keep-alive>
</router-view>
</div>
</template>
<script lang="ts" setup>
@ -24,4 +26,17 @@
};
</script>
<style lang="less" scoped></style>
<style lang="less" scoped>
// 子页面根节点配合 flex:1 + min-height:0 可填满主内容区
.page-layout-root {
height: 100%;
min-height: 0;
display: flex;
flex-direction: column;
}
.page-layout-root > * {
flex: 1;
min-height: 0;
}
</style>

View File

@ -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<string> = 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
// 让路由使用默认布局或父路由的布局,避免完全失败

View File

@ -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 {

View File

@ -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 = [];

View File

@ -167,7 +167,6 @@ export const useRbacUserStore = defineStore('rbacUser', () => {
// 这里需要根据实际 API 响应调整
if (!accessToken.value) {
// 临时方案:如果后端还没有返回 token,可能需要等待 API 更新
console.warn('登录响应中未找到 accessToken,可能需要更新 API')
}
}

View File

@ -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;
}
}

View File

@ -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,

View File

@ -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<any[]>([]);
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 @@
</div>
<!-- Handsontable 表格 -->
<div class="table-wrapper">
<div ref="tableContainerRef" class="table-wrapper">
<HandsontablePro
:key="`table-${activeName}-${currentPage}`"
:columns="columns"
@ -187,6 +193,7 @@
:current-page="currentPage"
:page-size="pageSize"
:search-params="searchParams"
:height="tableHeight"
:stretch-columns="true"
:show-action-column="false"
:show-checkbox-column="false"

View File

@ -1572,8 +1572,9 @@
:key="item.id"
class="interface-item"
:class="{ selected: selectedInterface?.id === item.id }"
@mousedown.left="selectInterface(item)"
>
<div class="interface-main-content" @click="selectInterface(item)">
<div class="interface-main-content">
<div class="interface-content">
<span v-if="selectedInterface?.id === item.id" class="selected-dot"></span>
<span class="interface-method" :class="getMethodClass(item.requestMethod)">
@ -1582,7 +1583,7 @@
<span class="interface-name">{{ item.name }}</span>
</div>
</div>
<div class="interface-actions" @click.stop>
<div class="interface-actions" @mousedown.stop @click.stop>
<a-dropdown>
<a-button
type="text"

View File

@ -26,7 +26,7 @@
const tableData = ref<any[]>([]);
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"
/>

View File

@ -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)"
>
<table class="provider-table">
<tr>
@ -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)"
>
<div class="vertical-dots-icon">
<span></span>

View File

@ -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');

View File

@ -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');

View File

@ -1231,7 +1231,6 @@ const formData = reactive({
// 搜索处理
const handleSearch = () => {
// TODO: 实现搜索逻辑
console.log('搜索关键词:', searchKeyword.value)
}
const appOptions = ref<Array<{ label: string; value: number }>>([])
@ -1355,7 +1354,6 @@ const loadChannelGroups = async () => {
// 如果API返回空数据,保留示例数据用于开发测试
if (channelGroups.value.length === 0) {
// 保留示例数据,不覆盖
console.log('使用示例数据')
}
} catch (error) {
console.error('加载渠道组列表失败:', error)

View File

@ -114,60 +114,28 @@
</div>
<div class="toolbar-right">
<div class="pagination-controls">
<span class="total-records">{{ $t('track.order.pagination.total', { count: totalCount }) }}</span>
<a-button
type="text"
size="small"
:disabled="currentPage === 1"
@click="handlePageChange(currentPage - 1)"
>
{{ $t('track.order.pagination.prev') }}
</a-button>
<span class="current-page">{{ currentPage }}</span>
<a-button
type="text"
size="small"
:disabled="currentPage * pageSize >= totalCount"
@click="handlePageChange(currentPage + 1)"
>
{{ $t('track.order.pagination.next') }}
</a-button>
<a-select
v-model="pageSize"
size="small"
:style="{ width: '90px' }"
@change="handlePageSizeChange"
>
<a-option :value="10">10</a-option>
<a-option :value="20">20</a-option>
<a-option :value="50">50</a-option>
</a-select>
<span class="page-size-text">{{ $t('track.order.pagination.perPage') }}</span>
<span class="go-to-text">{{ $t('track.order.pagination.goTo') }}</span>
<a-input-number
v-model="jumpPage"
size="small"
:style="{ width: '56px' }"
:min="1"
:max="totalPages"
@keyup.enter="handleJumpPage"
<PaginationPro
:total-count="totalCount"
v-model:current-page="currentPage"
v-model:page-size="pageSize"
@page-change="handlePageChange"
@page-size-change="handlePageSizeChange"
/>
<span class="page-text">{{ $t('track.order.pagination.page') }}</span>
</div>
</div>
</div>
<div class="table-scroll-wrap">
<HandsontablePro
ref="handsontableRef"
:columns="hotColumns"
:data="displayedData"
:total="totalCount"
:current-page="currentPage"
:page-size="pageSize"
:height="tableScrollHeight"
:read-only="true"
:stretch-columns="true"
/>
<div ref="tableContainerRef" class="list-wrap">
<HandsontablePro
ref="handsontableRef"
:columns="hotColumns"
:data="displayedData"
:total="totalCount"
:current-page="currentPage"
:page-size="pageSize"
:height="tableHeight"
:read-only="true"
:stretch-columns="true"
/>
</div>
</div>
</div>
@ -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<InstanceType<typeof HandsontablePro>>();
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;
});
</script>
@ -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;
}
}
</style>

View File

@ -43,60 +43,28 @@
</div>
<div class="toolbar-right">
<div class="pagination-controls">
<span class="total-records">{{ $t('track.order.pagination.total', { count: totalCount }) }}</span>
<a-button
type="text"
size="small"
:disabled="currentPage === 1"
@click="handlePageChange(currentPage - 1)"
>
{{ $t('track.order.pagination.prev') }}
</a-button>
<span class="current-page">{{ currentPage }}</span>
<a-button
type="text"
size="small"
:disabled="currentPage * pageSize >= totalCount"
@click="handlePageChange(currentPage + 1)"
>
{{ $t('track.order.pagination.next') }}
</a-button>
<a-select
v-model="pageSize"
size="small"
:style="{ width: '90px' }"
@change="handlePageSizeChange"
>
<a-option :value="10">10</a-option>
<a-option :value="20">20</a-option>
<a-option :value="50">50</a-option>
</a-select>
<span class="page-size-text">{{ $t('track.order.pagination.perPage') }}</span>
<span class="go-to-text">{{ $t('track.order.pagination.goTo') }}</span>
<a-input-number
v-model="jumpPage"
size="small"
:style="{ width: '56px' }"
:min="1"
:max="totalPages"
@keyup.enter="handleJumpPage"
<PaginationPro
:total-count="totalCount"
v-model:current-page="currentPage"
v-model:page-size="pageSize"
@page-change="handlePageChange"
@page-size-change="handlePageSizeChange"
/>
<span class="page-text">{{ $t('track.order.pagination.page') }}</span>
</div>
</div>
</div>
<div class="table-scroll-wrap">
<HandsontablePro
ref="handsontableRef"
:columns="hotColumns"
:data="displayedData"
:total="totalCount"
:current-page="currentPage"
:page-size="pageSize"
:height="tableScrollHeight"
:read-only="true"
:stretch-columns="true"
/>
<div ref="tableContainerRef" class="list-wrap">
<HandsontablePro
ref="handsontableRef"
:columns="hotColumns"
:data="displayedData"
:total="totalCount"
:current-page="currentPage"
:page-size="pageSize"
:height="tableHeight"
:read-only="true"
:stretch-columns="true"
/>
</div>
</div>
</div>
@ -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<InstanceType<typeof HandsontablePro>>();
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;
});
</script>
@ -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;
}
}
</style>

View File

@ -90,60 +90,28 @@
</div>
<div class="toolbar-right">
<div class="pagination-controls">
<span class="total-records">{{ $t('track.order.pagination.total', { count: totalCount }) }}</span>
<a-button
type="text"
size="small"
:disabled="currentPage === 1"
@click="handlePageChange(currentPage - 1)"
>
{{ $t('track.order.pagination.prev') }}
</a-button>
<span class="current-page">{{ currentPage }}</span>
<a-button
type="text"
size="small"
:disabled="currentPage * pageSize >= totalCount"
@click="handlePageChange(currentPage + 1)"
>
{{ $t('track.order.pagination.next') }}
</a-button>
<a-select
v-model="pageSize"
size="small"
:style="{ width: '90px' }"
@change="handlePageSizeChange"
>
<a-option :value="10">10</a-option>
<a-option :value="20">20</a-option>
<a-option :value="50">50</a-option>
</a-select>
<span class="page-size-text">{{ $t('track.order.pagination.perPage') }}</span>
<span class="go-to-text">{{ $t('track.order.pagination.goTo') }}</span>
<a-input-number
v-model="jumpPage"
size="small"
:style="{ width: '56px' }"
:min="1"
:max="totalPages"
@keyup.enter="handleJumpPage"
<PaginationPro
:total-count="totalCount"
v-model:current-page="currentPage"
v-model:page-size="pageSize"
@page-change="handlePageChange"
@page-size-change="handlePageSizeChange"
/>
<span class="page-text">{{ $t('track.order.pagination.page') }}</span>
</div>
</div>
</div>
<div class="table-scroll-wrap">
<HandsontablePro
ref="handsontableRef"
:columns="hotColumns"
:data="displayedData"
:total="totalCount"
:current-page="currentPage"
:page-size="pageSize"
:height="tableScrollHeight"
:read-only="true"
:stretch-columns="true"
/>
<div ref="tableContainerRef" class="list-wrap">
<HandsontablePro
ref="handsontableRef"
:columns="hotColumns"
:data="displayedData"
:total="totalCount"
:current-page="currentPage"
:page-size="pageSize"
:height="tableHeight"
:read-only="true"
:stretch-columns="true"
/>
</div>
</div>
</div>
@ -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<InstanceType<typeof HandsontablePro>>();
// 分页:当前页、每页条数、总条数、跳转页
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;
}
}
</style>

View File

@ -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<InstanceType<typeof OrderDetailDrawer>>();
@ -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 @@
</div>
</div>
<div class="handsontable-container list-wrap">
<div ref="tableContainerRef" class="list-wrap">
<HandsontablePro
:columns="hotColumns"
:data="processedTableData"
@ -499,10 +500,11 @@
:page-size="pageSize"
:show-action-column="true"
:action-column-position="'start'"
:action-column-width="56"
:action-column-width="60"
:action-renderer="actionRenderer"
:custom-cell-renderer="customCellRenderer"
:stretch-columns="true"
:height="tableHeight"
@action-click="handleActionClick"
@selection-change="handleSelectionChange"
/>
@ -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%;

File diff suppressed because it is too large Load Diff

View File

@ -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',
},
];

View File

@ -1,5 +1,6 @@
<template>
<div class="organization-page">
<div class="organization-page-card">
<div class="page-header">
<a-space>
<a-button
@ -79,6 +80,7 @@
</div>
</template>
</a-table>
</div>
<!-- 新增/编辑组织弹窗 -->
<a-modal
@ -346,15 +348,31 @@ async function handleDelete(id: string | undefined) {
<style scoped>
.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 {

View File

@ -1,5 +1,6 @@
<template>
<div class="user-page">
<div class="user-page-card">
<div class="page-header">
<a-space>
<a-button
@ -10,15 +11,6 @@
<template #icon><icon-plus /></template>
{{ t('system.user.actions.add') }}
</a-button>
<a-button
v-if="hasPermission('Rbac.Users.Delete')"
status="danger"
:disabled="!selectedRowKeys.length"
@click="handleBatchDelete"
>
<template #icon><icon-delete /></template>
{{ t('system.user.actions.batchDelete') }}
</a-button>
</a-space>
<a-space>
@ -39,78 +31,36 @@
<a-button @click="loadData">
<template #icon><icon-refresh /></template>
</a-button>
<PaginationPro
:total-count="pagination.total"
v-model:current-page="pagination.current"
v-model:page-size="pagination.pageSize"
@page-change="handlePageChange"
@page-size-change="handlePageSizeChange"
/>
</a-space>
</div>
<a-table
:columns="columns"
:data="dataSource"
:loading="loading"
:pagination="pagination"
:row-selection="rowSelection"
:scroll="{ x: 1200 }"
@page-change="handlePageChange"
@page-size-change="handlePageSizeChange"
>
<template #avatar="{ record }">
<a-avatar :image-url="record.avatar">
<template #trigger-icon><icon-user /></template>
</a-avatar>
</template>
<template #organizationName="{ record }">
{{ record.organizationName || '-' }}
</template>
<template #roles="{ record }">
<a-tag v-for="role in record.roles" :key="role.id" color="blue">
{{ role.name }}
</a-tag>
</template>
<template #createdAt="{ record }">
{{ dayjs(record.createdAt).format('YYYY-MM-DD HH:mm:ss') }}
</template>
<template #action="{ record }">
<div class="action-buttons">
<a-button
v-if="hasPermission('Rbac.Users.Update')"
type="text"
size="small"
class="action-btn edit-btn"
@click="handleEdit(record)"
:title="t('system.user.actions.edit')"
>
<IconEdit />
</a-button>
<a-button
v-if="hasPermission('Rbac.Users.AssignRoles')"
type="text"
size="small"
class="action-btn assign-btn"
@click="handleAssignRoles(record)"
:title="t('system.user.actions.assignRoles')"
>
<IconUserGroup />
</a-button>
<a-popconfirm
v-if="hasPermission('Rbac.Users.Delete')"
:content="t('system.user.modal.deleteConfirmContent', { count: 1 })"
@ok="handleDelete(record.id)"
>
<a-button
type="text"
size="small"
class="action-btn delete-btn"
:title="t('system.user.actions.delete')"
>
<IconDelete />
</a-button>
</a-popconfirm>
</div>
</template>
</a-table>
<div ref="tableContainerRef" class="list-wrap">
<HandsontablePro
ref="handsontableRef"
:columns="hotColumns"
:data="dataSource"
:total="pagination.total"
:current-page="pagination.current"
:page-size="pagination.pageSize"
:show-action-column="true"
:action-column-position="'end'"
:action-column-width="120"
:action-renderer="actionRenderer"
:custom-cell-renderer="customCellRenderer"
:stretch-columns="true"
:height="handsontableHeight"
:read-only="true"
@action-click="handleActionClick"
/>
</div>
</div>
<!-- 新增/编辑用户弹窗 -->
<a-modal
@ -206,24 +156,25 @@ import { Message, Modal } from '@arco-design/web-vue'
const { t } = useI18n()
import {
IconPlus,
IconDelete,
IconRefresh,
IconUser,
IconEdit,
IconUserGroup,
} from '@arco-design/web-vue/es/icon'
import { UserService, RoleService, OrganizationService } from '@/api/rbac'
import type { UserDto, UserCreateDto, UserUpdateDto, RoleSimpleDto, OrganizationTreeDto } from '@/api/rbac'
import { hasPermission } from '@/utils/rbac-permission'
import { handleApiError } from '@/utils/rbac-error-handler'
import HandsontablePro from '@/components/HandsontablePro/index.vue'
import PaginationPro from '@/components/PaginationPro/index.vue'
import { useTableContainerHeight } from '@/composables/useTableContainerHeight'
import dayjs from 'dayjs'
const loading = ref(false)
const dataSource = ref<UserDto[]>([])
const searchKeyword = ref('')
const filterOrganizationId = ref<string>()
const selectedRowKeys = ref<string[]>([])
const organizationTree = ref<OrganizationTreeDto[]>([])
const handsontableRef = ref<InstanceType<typeof HandsontablePro>>()
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 = '<svg viewBox="0 0 48 48" fill="none" stroke="currentColor" stroke-width="2" style="width:16px;height:16px"><path d="m30.48 19.038 5.733-5.734a1 1 0 0 0 0-1.414l-5.586-5.586a1 1 0 0 0-1.414 0l-5.734 5.734m7 7L15.763 33.754a1 1 0 0 1-.59.286l-6.048.708a1 1 0 0 1-1.113-1.069l.477-6.31a1 1 0 0 1 .29-.631l14.7-14.7m7 7-7-7M6 42h36"/></svg>'
const actionAssignIcon = '<svg viewBox="0 0 48 48" fill="none" stroke="currentColor" stroke-width="2" style="width:16px;height:16px"><circle cx="18" cy="16" r="6"/><circle cx="32" cy="18" r="5"/><path d="M6 38c0-6.627 5.373-12 12-12s12 5.373 12 12"/><path d="M28 36c.8-4.4 3.9-7.5 8.5-8.2"/></svg>'
const actionDeleteIcon = '<svg viewBox="0 0 48 48" fill="none" stroke="currentColor" stroke-width="2" style="width:16px;height:16px"><path d="M5 11h5.5m0 0v29a1 1 0 0 0 1 1h25a1 1 0 0 0 1-1V11m-27 0H16m21.5 0H43m-5.5 0H32m-16 0V7h16v4m-16 0h16M20 18v15m8-15v15"/></svg>'
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 '<span style="color:#86909c;">--</span>'
return `<img src="${avatarUrl}" style="width:28px;height:28px;border-radius:50%;object-fit:cover;" />`
}
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) => `<span style="display:inline-block;margin:2px 4px 2px 0;padding:2px 8px;border-radius:4px;background:#e8f3ff;color:#165dff;font-size:12px;">${name}</span>`).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(`<span data-action="edit" data-row-index="${rowIndex}" style="cursor:pointer;color:#165dff;display:inline-flex;" title="${t('system.user.actions.edit')}">${actionEditIcon}</span>`)
}
if (hasPermission('Rbac.Users.AssignRoles')) {
actions.push(`<span data-action="assignRoles" data-row-index="${rowIndex}" style="cursor:pointer;color:#165dff;display:inline-flex;" title="${t('system.user.actions.assignRoles')}">${actionAssignIcon}</span>`)
}
if (hasPermission('Rbac.Users.Delete')) {
actions.push(`<span data-action="delete" data-row-index="${rowIndex}" style="cursor:pointer;color:#f53f3f;display:inline-flex;" title="${t('system.user.actions.delete')}">${actionDeleteIcon}</span>`)
}
return `<div style="display:flex;align-items:center;justify-content:center;gap:20px;width:100%;">${actions.join('')}</div>`
}
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() {
<style scoped>
.user-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;
}
.user-page-card {
background: #fff;
border-radius: 8px;
padding: 16px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
box-sizing: border-box;
display: flex;
flex-direction: column;
overflow: hidden;
}
.page-header {
display: flex;
justify-content: space-between;
margin-bottom: 16px;
flex-shrink: 0;
gap: 12px;
}
.list-wrap {
width: 100%;
flex: 0 0 auto;
height: 1200px;
min-height: 0;
overflow: hidden;
overscroll-behavior: contain;
touch-action: pan-x pan-y;
}
.list-wrap :deep(.handsontable-pro-container) {
width: 100%;
flex: 1;
min-height: 0;
display: flex;
flex-direction: column;
}
.action-buttons {

View File

@ -1,5 +1,6 @@
<template>
<div class="menu-page">
<div class="menu-page-card">
<div class="page-header">
<a-space>
<a-button
@ -84,6 +85,7 @@
</div>
</template>
</a-table>
</div>
<!-- 新增/编辑菜单弹窗 -->
<a-modal
@ -390,15 +392,31 @@ function getIcon(iconName: string) {
<style scoped>
.menu-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;
}
.menu-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 {

View File

@ -1,5 +1,6 @@
<template>
<div class="role-page">
<div class="role-page-card">
<div class="page-header">
<a-space>
<a-button
@ -16,61 +17,36 @@
<a-button @click="loadData">
<template #icon><icon-refresh /></template>
</a-button>
<PaginationPro
:total-count="pagination.total"
v-model:current-page="pagination.current"
v-model:page-size="pagination.pageSize"
@page-change="handlePageChange"
@page-size-change="handlePageSizeChange"
/>
</a-space>
</div>
<a-table
:columns="columns"
:data="tableData"
:loading="loading"
:pagination="pagination"
@page-change="handlePageChange"
@page-size-change="handlePageSizeChange"
>
<template #createdAt="{ record }">
{{ dayjs(record.createdAt).format('YYYY-MM-DD HH:mm:ss') }}
</template>
<template #action="{ record }">
<div class="action-buttons">
<a-button
v-if="hasPermission('Rbac.Roles.Update')"
type="text"
size="small"
class="action-btn edit-btn"
@click="handleEdit(record)"
:title="t('system.role.actions.edit')"
>
<IconEdit />
</a-button>
<a-button
v-if="hasPermission('Rbac.Roles.AssignPermissions')"
type="text"
size="small"
class="action-btn assign-btn"
@click="handleAssignPermissions(record)"
:title="t('system.role.modal.assignPermissions')"
>
<IconSettings />
</a-button>
<a-popconfirm
v-if="hasPermission('Rbac.Roles.Delete')"
:content="t('system.role.modal.deleteConfirmContent', { count: 1 })"
@ok="handleDelete(record.id)"
>
<a-button
type="text"
size="small"
class="action-btn delete-btn"
:title="t('system.role.actions.delete')"
>
<IconDelete />
</a-button>
</a-popconfirm>
</div>
</template>
</a-table>
<div ref="tableContainerRef" class="list-wrap">
<HandsontablePro
ref="handsontableRef"
:columns="hotColumns"
:data="tableData"
:total="pagination.total"
:current-page="pagination.current"
:page-size="pagination.pageSize"
:show-action-column="true"
:action-column-position="'end'"
:action-column-width="120"
:action-renderer="actionRenderer"
:custom-cell-renderer="customCellRenderer"
:stretch-columns="true"
:height="handsontableHeight"
:read-only="true"
@action-click="handleActionClick"
/>
</div>
</div>
<!-- 新增/编辑角色弹窗 -->
<a-modal
v-model:visible="modalVisible"
@ -143,18 +119,23 @@
</template>
<script setup lang="ts">
import { ref, reactive, computed, onMounted, nextTick } from 'vue'
import { ref, reactive, computed, onMounted } from 'vue'
import { useI18n } from 'vue-i18n'
import { Message } from '@arco-design/web-vue'
import { IconPlus, IconRefresh, IconEdit, IconDelete, IconSettings } from '@arco-design/web-vue/es/icon'
import { Message, Modal } from '@arco-design/web-vue'
import { IconPlus, IconRefresh } from '@arco-design/web-vue/es/icon'
import { RoleService, PermissionService } from '@/api/rbac'
import type { RoleDto, RoleCreateDto, RoleUpdateDto, PermissionGroupDto, PermissionDefinitionDto } from '@/api/rbac'
import { useWarehouseList } from '@/composables/useWarehouseList'
import { hasPermission } from '@/utils/rbac-permission'
import { handleApiError } from '@/utils/rbac-error-handler'
import HandsontablePro from '@/components/HandsontablePro/index.vue'
import PaginationPro from '@/components/PaginationPro/index.vue'
import { useTableContainerHeight } from '@/composables/useTableContainerHeight'
import dayjs from 'dayjs'
const { t } = useI18n()
const { tableContainerRef, tableHeight } = useTableContainerHeight()
const handsontableHeight = computed(() => Math.max(tableHeight.value || 0, 400))
const loading = ref(false)
const dataSource = ref<RoleDto[]>([])
@ -180,14 +161,59 @@ const { warehouseOptions, getWarehouseNameById } = useWarehouseList()
// 角色与仓库绑定映射(后端未支持时暂存,可后续对接 API)
const roleWarehouseMap = ref<Record<string, string>>({})
const columns = computed(() => [
{ title: t('system.role.table.name'), dataIndex: 'name', width: 150 },
{ title: t('system.role.table.code'), dataIndex: 'code', width: 150 },
{ title: t('system.role.table.boundWarehouse'), dataIndex: 'boundWarehouse', width: 150 },
{ title: t('system.role.table.createTime'), slotName: 'createdAt', width: 180 },
{ title: t('system.role.table.actions'), slotName: 'action', width: 250, fixed: 'right' },
const hotColumns = computed(() => [
{ key: 'name', label: t('system.role.table.name'), width: 150 },
{ key: 'code', label: t('system.role.table.code'), width: 150 },
{ key: 'boundWarehouse', label: t('system.role.table.boundWarehouse'), width: 150 },
{ key: 'createdAt', label: t('system.role.table.createTime'), width: 180 },
])
const handsontableRef = ref<InstanceType<typeof HandsontablePro>>()
const actionEditIcon = '<svg viewBox="0 0 48 48" fill="none" stroke="currentColor" stroke-width="2" style="width:16px;height:16px"><path d="m30.48 19.038 5.733-5.734a1 1 0 0 0 0-1.414l-5.586-5.586a1 1 0 0 0-1.414 0l-5.734 5.734m7 7L15.763 33.754a1 1 0 0 1-.59.286l-6.048.708a1 1 0 0 1-1.113-1.069l.477-6.31a1 1 0 0 1 .29-.631l14.7-14.7m7 7-7-7M6 42h36"/></svg>'
const actionPermissionIcon = '<svg viewBox="0 0 48 48" fill="none" stroke="currentColor" stroke-width="2" style="width:16px;height:16px"><path d="M24 4 6 12v12c0 11.046 7.954 20.674 18 22 10.046-1.326 18-10.954 18-22V12L24 4Z"/><path d="M24 16v16M16 24h16"/></svg>'
const actionDeleteIcon = '<svg viewBox="0 0 48 48" fill="none" stroke="currentColor" stroke-width="2" style="width:16px;height:16px"><path d="M5 11h5.5m0 0v29a1 1 0 0 0 1 1h25a1 1 0 0 0 1-1V11m-27 0H16m21.5 0H43m-5.5 0H32m-16 0V7h16v4m-16 0h16M20 18v15m8-15v15"/></svg>'
function customCellRenderer(_row: number, col: number, _value: any, rowData: any): string | null {
const dataColIndex = col - 1
if (dataColIndex < 0 || dataColIndex >= hotColumns.value.length) return null
const key = hotColumns.value[dataColIndex].key
if (key === 'createdAt') {
return rowData?.createdAt ? dayjs(rowData.createdAt).format('YYYY-MM-DD HH:mm:ss') : '--'
}
return null
}
function actionRenderer(row: RoleDto, rowIndex: number): string {
const actions: string[] = []
if (hasPermission('Rbac.Roles.Update')) {
actions.push(`<span data-action="edit" data-row-index="${rowIndex}" style="cursor:pointer;color:#165dff;display:inline-flex;" title="${t('system.role.actions.edit')}">${actionEditIcon}</span>`)
}
if (hasPermission('Rbac.Roles.AssignPermissions')) {
actions.push(`<span data-action="assignPermissions" data-row-index="${rowIndex}" style="cursor:pointer;color:#165dff;display:inline-flex;" title="${t('system.role.modal.assignPermissions')}">${actionPermissionIcon}</span>`)
}
if (hasPermission('Rbac.Roles.Delete')) {
actions.push(`<span data-action="delete" data-row-index="${rowIndex}" style="cursor:pointer;color:#f53f3f;display:inline-flex;" title="${t('system.role.actions.delete')}">${actionDeleteIcon}</span>`)
}
return `<div style="display:flex;align-items:center;justify-content:center;gap:20px;width:100%;">${actions.join('')}</div>`
}
function handleActionClick(row: RoleDto, _rowIndex: number, action?: string) {
if (action === 'edit') {
handleEdit(row)
return
}
if (action === 'assignPermissions') {
handleAssignPermissions(row)
return
}
if (action === 'delete') {
Modal.confirm({
content: t('system.role.modal.deleteConfirmContent', { count: 1 }),
onOk: () => handleDelete(row.id),
})
}
}
// 表单相关
const modalVisible = ref(false)
const modalLoading = ref(false)
@ -442,15 +468,51 @@ onMounted(() => {
<style scoped>
.role-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;
}
.role-page-card {
background: #fff;
border-radius: 8px;
padding: 16px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
box-sizing: border-box;
display: flex;
flex-direction: column;
overflow: hidden;
}
.page-header {
display: flex;
justify-content: space-between;
margin-bottom: 16px;
flex-shrink: 0;
gap: 12px;
}
.list-wrap {
width: 100%;
flex: 0 0 auto;
height: 1200px;
min-height: 0;
overflow: hidden;
overscroll-behavior: contain;
touch-action: pan-x pan-y;
}
.list-wrap :deep(.handsontable-pro-container) {
width: 100%;
flex: 1;
min-height: 0;
display: flex;
flex-direction: column;
}
.permission-tree-container {

View File

@ -1,5 +1,6 @@
<template>
<div class="warehouse-address-page">
<div class="warehouse-address-page-card">
<div class="page-header">
<h2 class="page-title">{{ $t('system.warehouseAddress.pageTitle') }}</h2>
</div>
@ -73,6 +74,7 @@
</div>
</a-card>
</div>
</div>
<!-- 编辑/新增弹窗 -->
<a-modal
@ -292,13 +294,26 @@ onMounted(() => {
<style lang="less" scoped>
.warehouse-address-page {
padding: 24px;
background: #f5f5f5;
min-height: 100%;
width: 100%;
box-sizing: border-box;
padding: 16px;
background-color: #f0f3f4;
min-height: 100vh;
height: auto;
overflow-x: hidden;
overflow-y: auto;
}
.warehouse-address-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 {
margin-bottom: 24px;
margin-bottom: 16px;
.page-title {
margin: 0;

View File

@ -426,7 +426,6 @@
// 处理菜单选择
function handleMenuSelect(item: MenuItem) {
selectedMenu.value = item;
console.log('选中菜单:', item);
}
// 处理菜单新增
@ -451,7 +450,6 @@
}
Message.success('新建成功');
console.log('新增菜单:', newItem);
}
// 处理菜单编辑
@ -466,7 +464,6 @@
} else {
Message.error('编辑失败:未找到菜单项');
}
console.log('编辑菜单:', item);
}
// 处理菜单删除
@ -481,7 +478,6 @@
} else {
Message.error('删除失败:未找到菜单项');
}
console.log('删除菜单:', item);
}
// 递归添加子菜单

View File

@ -355,7 +355,7 @@
// 右侧表分页
const totalCount = ref(0);
const currentPage = ref(1);
const pageSize = ref(30);
const pageSize = ref(50);
const tableProps = reactive<any>({
useForm: false,
@ -607,7 +607,7 @@
pageSize: pageSize.value,
});
const res = response?.data || response;
totalCount.value = res?.totalCount || 0;
totalCount.value = Number(res?.totalCount ?? 0);
const items = res?.items || [];
tableRef.value?.reloadData?.(items);
} finally {

View File

@ -15,9 +15,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;
@ -39,7 +42,7 @@
const tableData = ref<any[]>([]);
const totalCount = ref(0);
const currentPage = ref(1);
const pageSize = ref(30);
const pageSize = ref(50);
const appMap = ref<Record<string, string>>({});
@ -135,7 +138,7 @@
pageIndex: currentPage.value,
pageSize: pageSize.value,
}) as API.GetTrackContentListDtoPagedResult;
totalCount.value = res?.totalCount || 0;
totalCount.value = Number(res?.totalCount ?? 0);
const items = res?.items || [];
tableData.value = items.map((item: any) => ({
...item,
@ -448,7 +451,8 @@
</script>
<template>
<div class="xxx-container" style="background-color: #fff;">
<div class="track-content-page">
<div class="track-content-page-card">
<a-input
v-model="searchKeyword"
:placeholder="$t('track.content.search.placeholder')"
@ -487,7 +491,7 @@
</div>
</div>
<div class="list-wrap">
<div ref="tableContainerRef" class="list-wrap">
<HandsontablePro
:columns="columns"
:data="tableData"
@ -500,11 +504,13 @@
:action-column-width="110"
:custom-cell-renderer="customCellRenderer"
:action-renderer="actionRenderer"
:height="handsontableHeight"
:read-only="true"
:stretch-columns="true"
@action-click="handleActionClick"
/>
</div>
</div>
<ModalForm
ref="modalFormRef"
@ -519,22 +525,32 @@
</template>
<style scoped lang="less">
.xxx-container {
padding: 16px;
background-color: #fff;
height: calc(100vh - 86px);
max-height: calc(100vh - 86px);
box-sizing: border-box;
.track-content-page {
width: 100%;
overflow: hidden;
box-sizing: border-box;
padding: 16px;
background-color: #f0f3f4;
min-height: 100vh;
height: auto;
overflow-x: hidden;
overflow-y: auto;
}
.track-content-page-card {
background: #fff;
border-radius: 8px;
padding: 16px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
box-sizing: border-box;
display: flex;
flex-direction: column;
overflow: hidden;
}
.search-input {
width: 20%;
max-width: 320px;
margin-bottom: 16px;
margin-left: 16px;
}
.table-toolbar {
@ -542,27 +558,25 @@
display: flex;
justify-content: space-between;
align-items: center;
.toolbar-left {
margin-left: 16px;
}
}
.list-wrap {
flex: 1;
width: 100%;
flex: 0 0 auto;
height: 1200px;
min-height: 0;
overflow: hidden;
display: flex;
flex-direction: column;
overscroll-behavior: contain;
touch-action: pan-x pan-y;
}
.list-wrap :deep(.handsontable-pro-container) {
flex: 1;
min-height: 0;
height: 100%;
}
.list-wrap :deep(.handsontable-wrapper) {
height: 100%;
width: 100%;
display: flex;
flex-direction: column;
}
</style>

View File

@ -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<any[]>([]);
const totalCount = ref(0);
const currentPage = ref(1);
const pageSize = ref(30);
const pageSize = ref(50);
const appMap = ref<Record<string, string>>({});
@ -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 @@
</script>
<template>
<div class="xxx-container" style="background-color: #fff;">
<div class="track-flag-page">
<div class="track-flag-page-card">
<a-input
v-model="searchKeyword"
:placeholder="$t('track.flag.search.placeholder')"
@ -334,7 +338,7 @@
</div>
</div>
<div class="list-wrap">
<div ref="tableContainerRef" class="list-wrap">
<HandsontablePro
:columns="columns"
:data="tableData"
@ -347,11 +351,13 @@
:action-column-width="110"
:custom-cell-renderer="customCellRenderer"
:action-renderer="actionRenderer"
:height="handsontableHeight"
:read-only="true"
:stretch-columns="true"
@action-click="handleActionClick"
/>
</div>
</div>
<ModalForm
ref="modalFormRef"
@ -366,22 +372,32 @@
</template>
<style scoped lang="less">
.xxx-container {
padding: 16px;
background-color: #fff;
height: calc(100vh - 86px);
max-height: calc(100vh - 86px);
box-sizing: border-box;
.track-flag-page {
width: 100%;
overflow: hidden;
box-sizing: border-box;
padding: 16px;
background-color: #f0f3f4;
min-height: 100vh;
height: auto;
overflow-x: hidden;
overflow-y: auto;
}
.track-flag-page-card {
background: #fff;
border-radius: 8px;
padding: 16px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
box-sizing: border-box;
display: flex;
flex-direction: column;
overflow: hidden;
}
.search-input {
width: 20%;
max-width: 320px;
margin-bottom: 16px;
margin-left: 16px;
}
.table-toolbar {
@ -389,27 +405,25 @@
display: flex;
justify-content: space-between;
align-items: center;
.toolbar-left {
margin-left: 16px;
}
}
.list-wrap {
flex: 1;
width: 100%;
flex: 0 0 auto;
height: 1200px;
min-height: 0;
overflow: hidden;
display: flex;
flex-direction: column;
overscroll-behavior: contain;
touch-action: pan-x pan-y;
}
.list-wrap :deep(.handsontable-pro-container) {
flex: 1;
min-height: 0;
height: 100%;
}
.list-wrap :deep(.handsontable-wrapper) {
height: 100%;
width: 100%;
display: flex;
flex-direction: column;
}
</style>

View File

@ -165,12 +165,12 @@
// 明细表分页状<EFBFBD>?
const totalCount = ref(0);
const currentPage = ref(1);
const pageSize = ref(30);
const pageSize = ref(50);
// 优先级 tab 分页
const priorityTotalCount = ref(0);
const priorityCurrentPage = ref(1);
const priorityPageSize = ref(30);
const priorityPageSize = ref(50);
const tableProps = reactive({
autoHeight: true,
@ -968,7 +968,7 @@
pageIndex: priorityCurrentPage.value,
pageSize: priorityPageSize.value,
}) as any;
priorityTotalCount.value = res?.totalCount || 0;
priorityTotalCount.value = Number(res?.totalCount ?? 0);
const items = res?.items || [];
tableRefPriority.value?.reloadData?.(items);
} catch (e) {
@ -1001,7 +1001,7 @@
pageIndex: currentPage.value,
pageSize: pageSize.value,
}) as API.GetTrackPullContentPageOutputVOPagedResult;
totalCount.value = res?.totalCount || 0;
totalCount.value = Number(res?.totalCount ?? 0);
const items = res?.items || [];
tableRef.value?.reloadData?.(items);
} finally {

View File

@ -155,7 +155,7 @@
// ?????????
const totalCount = ref(0);
const currentPage = ref(1);
const pageSize = ref(30);
const pageSize = ref(50);
// 固定列:与编辑页面字段一致(含拖动排序列)
const pushFixedLeftColumns = computed(() => [
@ -794,7 +794,7 @@
pageIndex: currentPage.value,
pageSize: pageSize.value,
}) as API.GetTrackPushContentPageOutputVOPagedResult;
totalCount.value = res?.totalCount || 0;
totalCount.value = Number(res?.totalCount ?? 0);
const items = res?.items || [];
const extraKeys = new Set<string>();
items.forEach((r: any) => {

View File

@ -62,10 +62,11 @@
</div>
<!-- 明细表格 -->
<div class="handsontable-container">
<div ref="tableContainerRef" class="handsontable-container">
<HandsontablePro
:columns="detailColumns"
:data="detailTableData"
:height="tableHeight"
@selection-change="handleDetailSelectionChange"
/>
</div>
@ -74,10 +75,11 @@
<!-- 推送记录 -->
<div v-if="activeTab === 'pushRecord'" class="push-record-content">
<!-- 推送记录表格 -->
<div class="handsontable-container">
<div ref="tableContainerRef" class="handsontable-container">
<HandsontablePro
:columns="pushRecordColumns"
:data="pushRecordTableData"
:height="tableHeight"
/>
</div>
</div>
@ -85,25 +87,31 @@
<!-- 日志 -->
<div v-if="activeTab === 'log'" class="log-content">
<!-- 操作日志表格 -->
<div class="handsontable-container">
<div ref="tableContainerRef" class="handsontable-container">
<HandsontablePro
:columns="logColumns"
:data="logTableData"
:height="tableHeight"
:stretch-columns="true"
/>
</div>
</div>
<!-- 轨迹抓取配置 -->
<!-- 轨迹抓取配置:ref 固定在始终存在的容器上,避免加载/空数据时高度为 0;a-spin 需参与 flex 撑满 -->
<div v-if="activeTab === 'pullConfig'" class="pull-config-content">
<a-spin :loading="pullConfigLoading">
<div v-if="pullConfigTableData.length" class="handsontable-container">
<HandsontablePro :columns="pullConfigColumns" :data="pullConfigTableData" />
<a-spin :loading="pullConfigLoading" class="pull-config-spin">
<div ref="tableContainerRef" class="handsontable-container pull-config-table-host">
<HandsontablePro
v-if="pullConfigTableData.length"
:columns="pullConfigColumns"
:data="pullConfigTableData"
:height="pullConfigHandsontableHeight"
/>
<a-empty
v-else-if="!pullConfigLoading"
:description="$t('track.order.pullConfig.noData')"
/>
</div>
<a-empty
v-else-if="!pullConfigLoading"
:description="$t('track.order.pullConfig.noData')"
/>
</a-spin>
</div>
</div>
@ -119,8 +127,10 @@ import useDrawer from '@/components/DrawerPro/useDrawer';
import { $baseMessage } from '@/utils';
import { getGetTrackPushRecords, getGetOrderOperationsById } from '@/api/TrackOrder/trackOrder';
import { postOrderFindOrderPullConfigs } from '@/api/InterfaceMappingProvider/order';
import { useTableContainerHeight } from '@/composables/useTableContainerHeight';
const { t } = useI18n();
const { tableContainerRef, tableHeight } = useTableContainerHeight();
interface Props {
orderId?: number;
@ -180,6 +190,11 @@ const pullConfigColumns = computed(() => [
{ key: 'endTime', label: t('track.order.pullConfig.table.endTime'), width: 180 },
]);
/** 抽屉内轨迹配置表:避免容器高度未算出时为 0 */
const pullConfigHandsontableHeight = computed(() =>
Math.max(tableHeight.value, 280)
);
const pullConfigTableData = computed(() =>
(pullConfigData.value || []).map((row: any) => ({
pullOrderNo: row?.pullOrderNo ?? '--',
@ -337,8 +352,16 @@ async function loadPullConfigData() {
orderType: props.orderType ?? 1,
orderNos
});
const items = response?.data?.items ?? response?.items ?? [];
pullConfigData.value = Array.isArray(items) ? items : [];
// request 拦截器可能已解包为 data 本体;兼容 items / data 数组等多种返回
let items: any[] = [];
if (Array.isArray(response)) {
items = response;
} else if (response && typeof response === 'object') {
if (Array.isArray(response.items)) items = response.items;
else if (Array.isArray(response.data?.items)) items = response.data.items;
else if (Array.isArray(response.data)) items = response.data;
}
pullConfigData.value = items;
} catch (error) {
$baseMessage('加载轨迹抓取配置失败', 'error');
pullConfigData.value = [];
@ -421,8 +444,24 @@ defineExpose({
}
.pull-config-content {
flex: 1;
min-height: 0;
padding: 16px 0;
min-height: 200px;
// Spin 默认 inline-block,在 flex 列里不撑高,会导致内部 Handsontable 高度为 0
.pull-config-spin {
flex: 1;
min-height: 0;
display: flex !important;
flex-direction: column;
width: 100%;
align-self: stretch;
}
.pull-config-table-host {
flex: 1;
min-height: 280px;
}
}
.detail-toolbar {

View File

@ -16,7 +16,7 @@ export function useTrackOrderData(options: {
const tableData = ref<any[]>([]);
const totalCount = ref(0);
const currentPage = ref(1);
const pageSize = ref(30);
const pageSize = ref(50);
const loading = ref(false);
// 加载表格数据

View File

@ -16,9 +16,11 @@
import { useTrackOrderActions } from './composables/useTrackOrderActions';
import { convertToTime } from './utils';
import { useContentHeight } from '@/composables/table/useContentHeight';
import { useTableContainerHeight } from '@/composables/useTableContainerHeight';
const { t } = useI18n();
const route = useRoute();
const { tableContainerRef, tableHeight } = useTableContainerHeight();
// 处理标签页刷新事件
const handlePageRefresh = (data: any) => {
@ -1747,7 +1749,7 @@
</div>
<!-- Handsontable 表格 -->
<div class="table-wrapper" style="overflow: auto; width: 100%; height: 100%;">
<div ref="tableContainerRef" class="list-wrap">
<HandsontablePro
:key="`table-${activeTab}-${currentPage}`"
ref="handsontableRef"
@ -1762,6 +1764,7 @@
:multi-value-fields="['orderNumber', 'trackNo', 'otherNo']"
:custom-cell-renderer="customCellRenderer"
:on-open-multi-value-modal="openMultiValueModal"
:height="tableHeight"
:enable-column-reorder="false"
:stretch-columns="true"
@action-click="openDetailDrawerHandler"
@ -2190,10 +2193,15 @@
.track-order-container {
padding: 16px; // 符合设计规范
background-color: #f0f3f4; // 与主背景统一
height: 100vh;
overflow: hidden;
width: 100vw; // 占满整个视窗宽度
max-width: 100vw;
min-height: 100vh;
height: auto;
overflow-x: hidden;
overflow-y: auto;
width: 100%;
max-width: 100%;
box-sizing: border-box;
display: flex;
flex-direction: column;
}
// 标签页区域
@ -2240,18 +2248,38 @@
}
}
// 表格区域
/*
* 列表滚动相关(Handsontable 实际滚动发生在 .ht_master > .wtHolder):
* - 高度:useTableContainerHeight 读取 .list-wrap 的 clientHeight → :height="tableHeight",决定 wtHolder 可视区高度。
* - 布局:.table-section 固定 1230px + 纵向 flex;.list-wrap flex:1 + min-height:0;HandsontablePro 根节点 flex 填满。
* - 外层 .track-order-container 为 overflow-y:auto 时,滚轮易冒泡到整页,体感像「拖不动」;对表区域加 overscroll-behavior:contain 优先把滚轮留在表内。
* - HandsontablePro 内 .ht_master 为 overflow:visible(克隆表头需要),横向/纵向滚动条样式写在 .wtHolder 上。
*/
.table-section {
background: #fff;
border-radius: 8px;
padding: 12px; // 减少padding,增加内容空间
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
height: calc(100vh - 80px); // 占满大部分高度
overflow: visible; // 改为visible,让内部滚动条能显示
box-sizing: border-box;
height: 1230px;
flex: 0 0 auto;
min-height: 0;
overflow: hidden;
display: flex;
flex-direction: column;
width: 100%; // 占满父容器宽度
max-width: 100%;
overscroll-behavior: contain;
}
.list-wrap {
flex: 1;
min-height: 0;
display: flex;
flex-direction: column;
overflow: hidden; // 仅裁剪外层,纵向/横向滚动交给 Handsontable .wtHolder
overscroll-behavior: contain;
touch-action: pan-x pan-y;
}
:deep(.el-button.is-link) {

View File

@ -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<any[]>([]);
const totalCount = ref(0);
const currentPage = ref(1);
const pageSize = ref(30);
const pageSize = ref(50);
const appMap = ref<Record<string, string>>({});
@ -130,7 +133,7 @@
pageIndex: currentPage.value,
pageSize: pageSize.value,
}) as API.GetTrackStatusListDtoPagedResult;
totalCount.value = res?.totalCount || 0;
totalCount.value = Number(res?.totalCount ?? 0);
const items = res?.items || [];
tableData.value = items.map((item: any) => ({
...item,
@ -333,7 +336,8 @@
</script>
<template>
<div class="xxx-container" style="background-color: #fff;">
<div class="track-state-page">
<div class="track-state-page-card">
<a-input
v-model="searchKeyword"
:placeholder="$t('track.state.search.placeholder')"
@ -372,7 +376,7 @@
</div>
</div>
<div class="list-wrap">
<div ref="tableContainerRef" class="list-wrap">
<HandsontablePro
:columns="columns"
:data="tableData"
@ -385,11 +389,13 @@
:action-column-width="110"
:custom-cell-renderer="customCellRenderer"
:action-renderer="actionRenderer"
:height="handsontableHeight"
:read-only="true"
:stretch-columns="true"
@action-click="handleActionClick"
/>
</div>
</div>
<ModalForm
ref="modalFormRef"
@ -404,22 +410,32 @@
</template>
<style scoped lang="less">
.xxx-container {
padding: 16px;
background-color: #fff;
height: calc(100vh - 86px);
max-height: calc(100vh - 86px);
box-sizing: border-box;
.track-state-page {
width: 100%;
overflow: hidden;
box-sizing: border-box;
padding: 16px;
background-color: #f0f3f4;
min-height: 100vh;
height: auto;
overflow-x: hidden;
overflow-y: auto;
}
.track-state-page-card {
background: #fff;
border-radius: 8px;
padding: 16px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
box-sizing: border-box;
display: flex;
flex-direction: column;
overflow: hidden;
}
.search-input {
width: 20%;
max-width: 320px;
margin-bottom: 16px;
margin-left: 16px;
}
.table-toolbar {
@ -427,27 +443,25 @@
display: flex;
justify-content: space-between;
align-items: center;
.toolbar-left {
margin-left: 16px;
}
}
.list-wrap {
flex: 1;
width: 100%;
flex: 0 0 auto;
height: 1200px;
min-height: 0;
overflow: hidden;
display: flex;
flex-direction: column;
overscroll-behavior: contain;
touch-action: pan-x pan-y;
}
.list-wrap :deep(.handsontable-pro-container) {
flex: 1;
min-height: 0;
height: 100%;
}
.list-wrap :deep(.handsontable-wrapper) {
height: 100%;
width: 100%;
display: flex;
flex-direction: column;
}
</style>

View File

@ -9,6 +9,7 @@
import { eventBus } from '@/utils/pub';
import HandsontablePro from '@/components/HandsontablePro/index.vue';
import PaginationPro from '@/components/PaginationPro/index.vue';
import { useTableContainerHeight } from '@/composables/useTableContainerHeight';
import { useContentHeight } from '@/composables/table/useContentHeight';
import { trackOrderGetOrderTypeDictGet } from '@/api/interface-trackOrder/trackOrder';
import { postGetList } from '@/api/TrackState/trackStatus';
@ -26,6 +27,7 @@
import TimeZoneConversion from '../trackOrder/components/TimeZoneConversion.vue';
const { t } = useI18n();
const { tableContainerRef, tableHeight } = useTableContainerHeight();
const route = useRoute();
const userStore = useUserStore();
const handsontableRef = ref<InstanceType<typeof HandsontablePro>>();
@ -106,7 +108,7 @@
const tableData = ref<any[]>([]);
const totalCount = ref(0);
const currentPage = ref(1);
const pageSize = ref(30);
const pageSize = ref(50);
const selectedRows = ref<any[]>([]);
// 搜索参数
@ -553,7 +555,7 @@
const response = await postWarningCompleteGetPageCompleteWarningDetails(params);
tableData.value = response.data?.items || response.data || [];
totalCount.value = response.data?.totalCount || response.data?.length || 0;
totalCount.value = Number(response.data?.totalCount ?? response.data?.length ?? 0);
} catch (error) {
$baseMessage(t('track.warningOrder.message.loadFailed'), 'error');
}
@ -1313,7 +1315,6 @@
:total-count="totalCount"
v-model:current-page="currentPage"
v-model:page-size="pageSize"
:page-sizes="[10, 30, 50, 100]"
@page-change="handlePageChange"
@page-size-change="handlePageSizeChange"
/>
@ -1322,7 +1323,7 @@
</div>
<!-- 列表区域:占满剩余高度,滚动条高度正确 -->
<div class="list-wrap">
<div ref="tableContainerRef" class="list-wrap">
<HandsontablePro
ref="handsontableRef"
:columns="columns"
@ -1337,6 +1338,7 @@
:action-renderer="actionRenderer"
:multi-value-fields="['orderNos']"
:custom-cell-renderer="customCellRenderer"
:height="tableHeight"
:read-only="false"
:stretch-columns="true"
@action-click="handleActionClick"

View File

@ -19,8 +19,10 @@
import { eventBus } from '@/utils/pub';
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();
const route = useRoute();
const [registerModal, { openModal, closeModal, setModalProps }] = useModal() as any;
@ -78,7 +80,7 @@
const tableData = ref<any[]>([]);
const totalCount = ref(0);
const currentPage = ref(1);
const pageSize = ref(30);
const pageSize = ref(50);
const selectedRows = ref<any[]>([]);
// 应用列表映射(appKey -> name)
@ -142,7 +144,7 @@
const response = await postWarningReturnGetPageReturnWarningDetails(params);
tableData.value = response.data?.items || response.data || [];
totalCount.value = response.data?.totalCount || response.data?.length || 0;
totalCount.value = Number(response.data?.totalCount ?? response.data?.length ?? 0);
} catch (error) {
$baseMessage(t('track.warningOrder.message.loadFailed'), 'error');
}
@ -322,7 +324,6 @@
:total-count="totalCount"
v-model:current-page="currentPage"
v-model:page-size="pageSize"
:page-sizes="[10, 30, 50, 100]"
@page-change="handlePageChange"
@page-size-change="handlePageSizeChange"
/>
@ -331,7 +332,7 @@
</div>
<!-- 列表区域:占满剩余高度,滚动条高度正确 -->
<div class="list-wrap">
<div ref="tableContainerRef" class="list-wrap">
<HandsontablePro
ref="handsontableRef"
:columns="columns"
@ -343,6 +344,7 @@
:show-action-column="true"
:multi-value-fields="['orderNos']"
:custom-cell-renderer="customCellRenderer"
:height="tableHeight"
:stretch-columns="true"
@action-click="onViewPushRecord"
@search="handleHeaderSearch"

View File

@ -18,6 +18,7 @@
import { eventBus } from '@/utils/pub';
import HandsontablePro from '@/components/HandsontablePro/index.vue';
import PaginationPro from '@/components/PaginationPro/index.vue';
import { useTableContainerHeight } from '@/composables/useTableContainerHeight';
import TablePro from '@/components/TablePro/index.vue';
import FormPro from '@/components/FormPro/index.vue';
@ -26,6 +27,7 @@
import { useContentHeight } from '@/composables/table/useContentHeight';
const { t } = useI18n();
const { tableContainerRef, tableHeight } = useTableContainerHeight();
const userStore = useUserStore();
const handsontableRef = ref<InstanceType<typeof HandsontablePro>>();
@ -130,7 +132,7 @@
const tableData = ref<any[]>([]);
const totalCount = ref(0);
const currentPage = ref(1);
const pageSize = ref(30);
const pageSize = ref(50);
const selectedRows = ref<any[]>([]);
// 搜索参数
@ -172,7 +174,7 @@
const response: any = await postWarningTransportGetPageTransportWarningDetails(params);
tableData.value = response.data?.items || response.data || [];
totalCount.value = response.data?.totalCount || response.data?.length || 0;
totalCount.value = Number(response.data?.totalCount ?? response.data?.length ?? 0);
} catch (error) {
$baseMessage(t('track.warningOrder.message.loadFailed'), 'error');
}
@ -386,7 +388,6 @@
:total-count="totalCount"
v-model:current-page="currentPage"
v-model:page-size="pageSize"
:page-sizes="[10, 30, 50, 100]"
@page-change="handlePageChange"
@page-size-change="handlePageSizeChange"
/>
@ -395,7 +396,7 @@
</div>
<!-- 列表区域:占满剩余高度,滚动条高度正确 -->
<div class="list-wrap">
<div ref="tableContainerRef" class="list-wrap">
<HandsontablePro
ref="handsontableRef"
:columns="columns"
@ -407,6 +408,7 @@
:show-action-column="true"
:multi-value-fields="['orderNos']"
:custom-cell-renderer="customCellRenderer"
:height="tableHeight"
:stretch-columns="true"
@action-click="() => {}"
@search="handleHeaderSearch"

View File

@ -1,5 +1,6 @@
<template>
<div class="customer-page">
<div class="customer-page-card">
<!-- 表格工具栏:左侧新增按钮 + 右侧分页 -->
<div class="table-toolbar">
<div class="toolbar-left">
@ -10,50 +11,19 @@
</div>
<div class="toolbar-right">
<div class="pagination-controls">
<span class="total-records">{{ t('user.customer.pagination.total', { count: totalCount }) }}</span>
<a-button
type="text"
size="small"
:disabled="currentPage === 1"
@click="handlePageChange(currentPage - 1)"
>
{{ t('user.customer.pagination.prev') }}
</a-button>
<span class="current-page">{{ currentPage }}</span>
<a-button
type="text"
size="small"
:disabled="currentPage * pageSize >= totalCount"
@click="handlePageChange(currentPage + 1)"
>
{{ t('user.customer.pagination.next') }}
</a-button>
<a-select
v-model="pageSize"
size="small"
:style="{ width: '110px' }"
@change="handlePageSizeChange"
>
<a-option :value="10">10</a-option>
<a-option :value="20">20</a-option>
<a-option :value="50">50</a-option>
<a-option :value="100">100</a-option>
</a-select>
<span class="page-size-text">{{ t('user.customer.pagination.perPage') }}</span>
<span class="go-to-text">{{ t('user.customer.pagination.goTo') }}</span>
<a-input-number
v-model="jumpPage"
size="small"
:style="{ width: '60px' }"
@keyup.enter="handleJumpPage"
<PaginationPro
:total-count="totalCount"
v-model:current-page="currentPage"
v-model:page-size="pageSize"
@page-change="handlePageChange"
@page-size-change="handlePageSizeChange"
/>
<span class="page-text">{{ t('user.customer.pagination.page') }}</span>
</div>
</div>
</div>
<!-- 列表区域 -->
<div class="list-wrap" @click="handleListClick">
<!-- 列表区域:固定高度 + mousedown 捕获,避免状态开关与 Handsontable 抢事件 -->
<div ref="tableContainerRef" class="list-wrap" @mousedown.capture="handleStatusSwitchMouseDown">
<HandsontablePro
ref="handsontableRef"
:columns="hotColumns"
@ -62,14 +32,16 @@
:current-page="currentPage"
:page-size="pageSize"
:show-action-column="true"
:action-column-position="'end'"
:action-column-width="140"
:action-column-position="'start'"
:action-column-width="100"
:action-renderer="actionRenderer"
:custom-cell-renderer="customCellRenderer"
:stretch-columns="true"
:height="handsontableHeight"
@action-click="handleActionClick"
/>
</div>
</div>
<!-- 编辑弹窗 -->
<a-modal
@ -138,7 +110,6 @@
>
<a-option :value="1">{{ t('user.customer.status.enabled') }}</a-option>
<a-option :value="0">{{ t('user.customer.status.disabled') }}</a-option>
<a-option :value="2">{{ t('user.customer.status.frozen') }}</a-option>
</a-select>
</a-form-item>
<a-form-item :label="t('user.customer.fields.role')" field="role">
@ -191,15 +162,22 @@ import { useI18n } from 'vue-i18n'
import { Message, Modal } from '@arco-design/web-vue'
import { IconPlus } 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 type { CustomerDto } from '@/api/customer'
import { CustomerService } from '@/api/customer'
import dayjs from 'dayjs'
const { t } = useI18n()
type CustomerRow = CustomerDto & { role?: string }
const { tableContainerRef, tableHeight } = useTableContainerHeight()
/** 列表区固定高度后由 ResizeObserver 得到稳定像素;兜底避免传 0 */
const handsontableHeight = computed(() => Math.max(tableHeight.value || 0, 400))
// 50 条假数据
function createMockData(): CustomerDto[] {
const list: CustomerDto[] = []
function createMockData(): CustomerRow[] {
const list: CustomerRow[] = []
const names = ['张三', '李四', '王五', '赵六', '钱七', '孙八', '周九', '吴十', '郑十一', '王小明']
const sales = ['销售A', '销售B', '销售C']
const cs = ['客服甲', '客服乙', '客服丙']
@ -217,7 +195,7 @@ function createMockData(): CustomerDto[] {
accountBalance: Math.floor(Math.random() * 10000),
totalQuota: 50000 + Math.floor(Math.random() * 50000),
usedQuota: Math.floor(Math.random() * 30000),
status: (i % 7 === 0 ? 2 : i % 5 === 0 ? 0 : 1) as 0 | 1 | 2,
status: (i % 5 === 0 ? 0 : 1) as 0 | 1,
customerGroup: (i % 6) as 0 | 1 | 2 | 3 | 4 | 5,
remark: i % 4 === 0 ? `备注${i}` : '',
createTime,
@ -236,12 +214,11 @@ function createMockData(): CustomerDto[] {
return list
}
const mockData = ref<CustomerDto[]>(createMockData())
const mockData = ref<CustomerRow[]>(createMockData())
// 分页
const currentPage = ref(1)
const pageSize = ref(10)
const jumpPage = ref(1)
const pageSize = ref(50)
const totalCount = computed(() => mockData.value.length)
// 当前页数据
@ -272,12 +249,11 @@ const hotColumns = computed(() => [
{ key: 'updateTime', label: t('user.customer.fields.updateTime'), width: 150 },
{ key: 'updateBy', label: t('user.customer.fields.updateBy'), width: 90 },
{ key: 'lastOnlineTime', label: t('user.customer.fields.lastOnlineTime'), width: 150 },
{ key: 'lastOnlineIp', label: t('user.customer.fields.lastOnlineIp'), width: 110 },
])
// 自定义单元格渲染(col: 0=序号, 1..n=数据列, n+1=操作列;actionColumnPosition=end)
// 自定义单元格渲染(操作列在前,col: 0=操作列, 1=序号, 2..n=数据列)
function customCellRenderer(row: number, col: number, value: any, rowData: any): string | null {
const dataColIndex = col - 1
const dataColIndex = col - 2
if (dataColIndex < 0 || dataColIndex >= hotColumns.value.length) return null
const colKey = hotColumns.value[dataColIndex].key
@ -288,12 +264,7 @@ function customCellRenderer(row: number, col: number, value: any, rowData: any):
if (colKey === 'status') {
const s = rowData?.status
const enabled = s === 1
const frozen = s === 2
const text = enabled ? t('user.customer.status.enabled') : frozen ? t('user.customer.status.frozen') : t('user.customer.status.disabled')
const bg = enabled ? '#00b42a' : frozen ? '#f53f3f' : '#e5e6eb'
if (frozen) {
return `<span style="display:inline-block;padding:2px 8px;border-radius:4px;font-size:12px;background:${bg};color:#fff;">${text}</span>`
}
const text = enabled ? t('user.customer.status.enabled') : t('user.customer.status.disabled')
return `
<label class="customer-status-switch" data-row-index="${row}" style="display:inline-flex;align-items:center;cursor:pointer;margin:0;">
<input type="checkbox" ${enabled ? 'checked' : ''} style="display:none;">
@ -344,7 +315,7 @@ const iconDelete = '<svg viewBox="0 0 48 48" fill="none" stroke="currentColor" s
function actionRenderer(row: any, rowIndex: number): string {
return `
<div class="action-btns" style="display:flex;gap:8px;align-items:center;">
<div class="action-btns" style="display:flex;gap:8px;align-items:center;justify-content:center;width:100%;">
<span data-action="edit" data-row-index="${rowIndex}" style="cursor:pointer;color:#165dff;display:inline-flex;" title="${t('user.customer.actions.edit')}">${iconEdit}</span>
<span data-action="resetPassword" data-row-index="${rowIndex}" style="cursor:pointer;color:#165dff;display:inline-flex;" title="${t('user.customer.actions.resetPassword')}">${iconLock}</span>
<span data-action="omsLogin" data-row-index="${rowIndex}" style="cursor:pointer;color:#165dff;display:inline-flex;" title="${t('user.customer.actions.omsLogin')}">${iconExport}</span>
@ -353,18 +324,17 @@ function actionRenderer(row: any, rowIndex: number): string {
`
}
// 列表点击(状态开关)
function handleListClick(e: MouseEvent) {
const switchEl = (e.target as HTMLElement).closest('.customer-status-switch')
if (switchEl) {
e.preventDefault()
e.stopPropagation()
const rowIndex = parseInt(switchEl.getAttribute('data-row-index') || '0')
const idx = (currentPage.value - 1) * pageSize.value + rowIndex
const record = mockData.value[idx]
if (record) {
record.status = record.status === 1 ? 0 : 1
}
/** 在捕获阶段处理开关,避免 Handsontable 先拦截 mousedown 导致无法切换 / 点击异常 */
function handleStatusSwitchMouseDown(e: MouseEvent) {
const switchEl = (e.target as HTMLElement | null)?.closest?.('.customer-status-switch')
if (!switchEl) return
e.preventDefault()
e.stopPropagation()
const rowIndex = parseInt(switchEl.getAttribute('data-row-index') || '0', 10)
const idx = (currentPage.value - 1) * pageSize.value + rowIndex
const record = mockData.value[idx]
if (record) {
record.status = record.status === 1 ? 0 : 1
}
}
@ -393,23 +363,11 @@ function handleActionClick(row: any, rowIndex: number, action?: string) {
// 分页
function handlePageChange(page: number) {
currentPage.value = page
jumpPage.value = page
}
function handlePageSizeChange(size: number) {
pageSize.value = size
currentPage.value = 1
jumpPage.value = 1
}
function handleJumpPage() {
const page = Number(jumpPage.value)
const maxPage = Math.ceil(totalCount.value / pageSize.value)
if (page > 0 && page <= maxPage) {
currentPage.value = page
} else {
Message.warning(t('user.customer.pagination.invalidPage'))
}
}
// 表单
@ -419,7 +377,7 @@ const isEdit = ref(false)
const formRef = ref()
const currentId = ref('')
const formState = reactive<Partial<CustomerDto & { role?: string }>>({
const formState = reactive<Partial<CustomerRow>>({
customerCode: '',
customerName: '',
wechatAvatarUrl: '',
@ -464,7 +422,7 @@ function handleAdd() {
modalVisible.value = true
}
function handleEdit(record: CustomerDto) {
function handleEdit(record: CustomerRow) {
isEdit.value = true
currentId.value = record.id || ''
Object.assign(formState, {
@ -501,11 +459,11 @@ function handleDelete(id: string | undefined) {
})
}
function handleResetPassword(record: CustomerDto) {
function handleResetPassword(record: CustomerRow) {
Message.success(t('user.customer.message.resetPasswordSuccess'))
}
function handleOmsLogin(record: CustomerDto) {
function handleOmsLogin(record: CustomerRow) {
const url = CustomerService.getOmsLoginUrl(record.id!)
window.open(url, '_blank')
}
@ -526,7 +484,7 @@ function handleModalOk() {
Message.success(t('user.customer.message.updateSuccess'))
} else {
const now = dayjs().format('YYYY-MM-DD HH:mm:ss')
const newItem: CustomerDto = {
const newItem: CustomerRow = {
...formState,
id: `cust-${Date.now()}`,
customerCode: formState.customerCode || `W25${String(mockData.value.length + 1).padStart(2, '0')}`,
@ -548,21 +506,33 @@ function handleModalCancel() {
}
const handsontableRef = ref<InstanceType<typeof HandsontablePro>>()
onMounted(() => {
jumpPage.value = currentPage.value
})
</script>
<style scoped lang="less">
// 与「我的订单」等页一致:整页可纵向滚动,列表区固定高度由 Handsontable .wtHolder 承担滚动
.customer-page {
width: 100%;
box-sizing: border-box;
padding: 16px;
display: flex;
flex-direction: column;
height: calc(100vh - 100px);
width: 100%;
box-sizing: border-box;
background: #f0f3f4;
min-height: 100vh;
height: auto;
overflow-x: hidden;
overflow-y: auto;
}
.customer-page-card {
flex: 0 0 auto;
display: flex;
flex-direction: column;
background: #fff;
border-radius: 8px;
padding: 16px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
box-sizing: border-box;
overflow: hidden;
}
.table-toolbar {
@ -582,36 +552,22 @@ onMounted(() => {
.pagination-controls {
display: flex;
align-items: center;
gap: 8px;
font-size: 12px;
.total-records {
color: #86909c;
margin-right: 4px;
}
.current-page {
min-width: 24px;
text-align: center;
}
.page-size-text,
.go-to-text,
.page-text {
color: #86909c;
}
}
}
}
.list-wrap {
flex: 1;
min-height: 0;
min-width: 0;
width: 100%;
min-width: 0;
flex: 0 0 auto;
height: 1200px;
min-height: 0;
display: flex;
flex-direction: column;
overflow: hidden;
overscroll-behavior: contain;
touch-action: pan-x pan-y;
position: relative;
.customer-status-switch {
user-select: none;
@ -621,35 +577,13 @@ onMounted(() => {
}
}
/* 表头与数据对齐、列表撑满 */
/* 仅拉伸容器,不覆盖 Handsontable 根节点 height(避免与 .wtHolder 内部滚动冲突) */
.list-wrap :deep(.handsontable-pro-container) {
width: 100%;
flex: 1;
min-width: 0;
}
.list-wrap :deep(.handsontable) {
width: 100% !important;
.htCore {
table-layout: fixed;
width: 100% !important;
th,
td {
box-sizing: border-box;
padding: 7px 16px !important;
vertical-align: middle !important;
}
th {
padding: 7px 16px !important;
}
}
/* 表头与内容区对齐:内容区有垂直滚动条时,表头预留滚动条宽度 */
.ht_clone_top .wtHolder {
margin-right: 17px;
}
min-height: 0;
display: flex;
flex-direction: column;
}
</style>

View File

@ -1,5 +1,6 @@
<template>
<div class="recharge-record-page">
<div class="recharge-record-page-card">
<!-- 表格工具栏:右侧分页 -->
<div class="table-toolbar">
<div class="toolbar-left" />
@ -9,7 +10,6 @@
:total-count="totalCount"
v-model:current-page="currentPage"
v-model:page-size="pageSize"
:page-sizes="[10, 20, 50, 100]"
@page-change="handlePageChange"
@page-size-change="handlePageSizeChange"
/>
@ -17,8 +17,8 @@
</div>
</div>
<!-- 列表区域 -->
<div class="list-wrap">
<!-- 列表区域:固定高度 + 捕获「查看」点击,避免被 Handsontable 拦截 -->
<div ref="tableContainerRef" class="list-wrap" @click.capture="handleViewPayImageClick">
<HandsontablePro
ref="handsontableRef"
:columns="hotColumns"
@ -27,15 +27,32 @@
:current-page="currentPage"
:page-size="pageSize"
:show-action-column="true"
:action-column-position="'start'"
:action-column-position="'end'"
:action-column-width="100"
:row-height="72"
:action-renderer="actionRenderer"
:custom-cell-renderer="customCellRenderer"
:stretch-columns="true"
:height="handsontableHeight"
@action-click="handleActionClick"
/>
</div>
</div>
<a-modal
v-model:visible="imagePreviewVisible"
:title="t('user.recharge.record.table.payImage')"
:footer="false"
width="640px"
>
<div class="image-preview-wrap">
<img
v-if="previewImageUrl"
:src="previewImageUrl"
:alt="t('user.recharge.record.table.payImage')"
class="image-preview"
/>
</div>
</a-modal>
</div>
</template>
@ -45,13 +62,19 @@ import { useI18n } from 'vue-i18n'
import { Message } from '@arco-design/web-vue'
import HandsontablePro from '@/components/HandsontablePro/index.vue'
import PaginationPro from '@/components/PaginationPro/index.vue'
import { useTableContainerHeight } from '@/composables/useTableContainerHeight'
import dayjs from 'dayjs'
import zfbIcon from '@/assets/zfb.png'
import wxIcon from '@/assets/wx.png'
defineOptions({
name: 'VipRechargeRechargeRecord',
})
const { t } = useI18n()
const { tableContainerRef, tableHeight } = useTableContainerHeight()
/** 与列表容器固定高度配合,避免首帧为 0 */
const handsontableHeight = computed(() => Math.max(tableHeight.value || 0, 400))
// 本地 mock 凭证缩略图(避免 /api/upload/sample*.jpg 走代理到后端导致 404)
const MOCK_PAY_IMAGE_DATA_URL =
@ -95,13 +118,15 @@ const mockData = ref<RechargeRecord[]>(createMockData())
// 分页
const currentPage = ref(1)
const pageSize = ref(10)
const pageSize = ref(50)
const totalCount = computed(() => mockData.value.length)
const processedTableData = computed(() => {
const start = (currentPage.value - 1) * pageSize.value
return mockData.value.slice(start, start + pageSize.value)
})
const imagePreviewVisible = ref(false)
const previewImageUrl = ref('')
// HandsontablePro 列定义
const hotColumns = computed(() => [
@ -114,37 +139,40 @@ const hotColumns = computed(() => [
{ key: 'remarks', label: t('user.recharge.record.table.remarks'), width: 150 },
])
// Arco 风格缺省图占位(缩略图无图时使用)
const ARCO_EMPTY_PLACEHOLDER = `<span class="recharge-thumb-empty" style="display:inline-flex;align-items:center;justify-content:center;width:64px;height:48px;background:var(--color-fill-2);color:var(--color-text-3);border-radius:4px;flex-shrink:0"><svg width="24" height="24" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M44 24V9H4v30h20" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M4 9l20 15 20-15" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M34 24a6 6 0 1 1 0 12 6 6 0 0 1 0-12z" stroke="currentColor" stroke-width="2"/></svg></span>`
// 自定义单元格渲染(操作+序号在前两列时,dataColIndex = col - 2)
// 操作列在末尾:col 0=序号,col 1..n=数据列 → dataColIndex = col - 1
function customCellRenderer(row: number, col: number, value: any, rowData: any): string | null {
const dataColIndex = col - 2
const dataColIndex = col - 1
if (dataColIndex < 0 || dataColIndex >= hotColumns.value.length) return null
const colKey = hotColumns.value[dataColIndex].key
if (colKey === 'payType') {
if (rowData?.payType === 'zfb') return t('user.recharge.record.payment.alipay')
if (rowData?.payType === 'wx') return t('user.recharge.record.payment.wechat')
if (rowData?.payType === 'zfb') {
return `<span style="display:inline-flex;align-items:center;gap:6px;"><img src="${zfbIcon}" alt="${t('user.recharge.record.payment.alipay')}" style="width:16px;height:16px;object-fit:contain;" /><span>${t('user.recharge.record.payment.alipay')}</span></span>`
}
if (rowData?.payType === 'wx') {
return `<span style="display:inline-flex;align-items:center;gap:6px;"><img src="${wxIcon}" alt="${t('user.recharge.record.payment.wechat')}" style="width:16px;height:16px;object-fit:contain;" /><span>${t('user.recharge.record.payment.wechat')}</span></span>`
}
return '--'
}
if (colKey === 'payAmount') {
return rowData?.payAmount != null ? `¥${rowData.payAmount}` : '--'
}
if (colKey === 'payImage') {
const thumbH = 48
const thumbW = 64
if (rowData?.payImage) {
const emptyEscaped = ARCO_EMPTY_PLACEHOLDER.replace(/"/g, '&quot;').replace(/'/g, '&#39;')
return `<span style="display:inline-block;width:${thumbW}px;height:${thumbH}px;border-radius:4px;overflow:hidden;flex-shrink:0" data-empty="${emptyEscaped}"><img src="${rowData.payImage}" style="width:100%;height:100%;object-fit:cover" onerror="var p=this.parentElement;if(p&&p.dataset.empty){p.innerHTML=p.dataset.empty}"></span>`
}
return ARCO_EMPTY_PLACEHOLDER
if (!rowData?.payImage) return '--'
const imageEscaped = String(rowData.payImage).replace(/"/g, '&quot;')
return `<span data-role="view-pay-image" data-image-url="${imageEscaped}" style="color:var(--app-primary-color);cursor:pointer;">查看</span>`
}
if (colKey === 'payStatus') {
const status = rowData?.payStatus
if (status === '0') return `<span style="font-weight:bold;color:#165dff">${t('user.recharge.record.search.statusPending')}</span>`
if (status === '1') return `<span style="font-weight:bold;color:#00b42a">${t('user.recharge.record.search.statusSuccess')}</span>`
if (status === '2') return `<span style="font-weight:bold;color:#f53f3f">${t('user.recharge.record.search.statusFailed')}</span>`
if (status === '0') {
return `<span style="display:inline-flex;align-items:center;height:24px;padding:0 10px;border-radius:4px;font-size:12px;font-weight:500;color:#4e5969;background:#f2f3f5;border:1px solid #e5e6eb;">${t('user.recharge.record.search.statusPending')}</span>`
}
if (status === '1') {
return `<span style="display:inline-flex;align-items:center;height:24px;padding:0 10px;border-radius:4px;font-size:12px;font-weight:500;color:#00b42a;background:#e8ffea;border:1px solid #b9f0c2;">${t('user.recharge.record.search.statusSuccess')}</span>`
}
if (status === '2') {
return `<span style="display:inline-flex;align-items:center;height:24px;padding:0 10px;border-radius:4px;font-size:12px;font-weight:500;color:#f53f3f;background:#ffece8;border:1px solid #fdcdc5;">${t('user.recharge.record.search.statusFailed')}</span>`
}
return '--'
}
if (colKey === 'remarks') {
@ -159,7 +187,7 @@ const iconReject = '<svg viewBox="0 0 48 48" fill="none" stroke="currentColor" s
function actionRenderer(row: any, rowIndex: number): string {
return `
<div class="action-btns" style="display:flex;gap:8px;align-items:center;">
<div class="action-btns" style="display:flex;gap:8px;align-items:center;justify-content:center;width:100%;">
<span data-action="approve" data-row-index="${rowIndex}" style="cursor:pointer;color:#00b42a;display:inline-flex;" title="${t('user.recharge.record.actions.approve')}">${iconApprove}</span>
<span data-action="reject" data-row-index="${rowIndex}" style="cursor:pointer;color:#f53f3f;display:inline-flex;" title="${t('user.recharge.record.actions.reject')}">${iconReject}</span>
</div>
@ -189,17 +217,43 @@ function handlePageSizeChange(size: number) {
}
const handsontableRef = ref<InstanceType<typeof HandsontablePro>>()
function handleViewPayImageClick(event: MouseEvent) {
const trigger = (event.target as HTMLElement | null)?.closest?.('[data-role="view-pay-image"]')
if (!trigger) return
const imageUrl = trigger.getAttribute('data-image-url')
if (!imageUrl) return
event.preventDefault()
event.stopPropagation()
previewImageUrl.value = imageUrl
imagePreviewVisible.value = true
}
</script>
<style lang="less" scoped>
.recharge-record-page {
width: 100%;
box-sizing: border-box;
padding: 16px;
display: flex;
flex-direction: column;
height: calc(100vh - 100px);
width: 100%;
box-sizing: border-box;
background: #f0f3f4;
min-height: 100vh;
height: auto;
overflow-x: hidden;
overflow-y: auto;
}
.recharge-record-page-card {
flex: 0 0 auto;
display: flex;
flex-direction: column;
background: #fff;
border-radius: 8px;
padding: 16px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
box-sizing: border-box;
overflow: hidden;
}
.table-toolbar {
@ -218,47 +272,36 @@ const handsontableRef = ref<InstanceType<typeof HandsontablePro>>()
}
.list-wrap {
flex: 1;
min-height: 0;
min-width: 0;
width: 100%;
min-width: 0;
flex: 0 0 auto;
height: 1200px;
min-height: 0;
display: flex;
flex-direction: column;
overflow: hidden;
overscroll-behavior: contain;
touch-action: pan-x pan-y;
}
.list-wrap :deep(.handsontable-pro-container) {
width: 100%;
flex: 1;
min-width: 0;
min-height: 0;
display: flex;
flex-direction: column;
}
.list-wrap :deep(.handsontable) {
width: 100% !important;
.image-preview-wrap {
display: flex;
justify-content: center;
}
.htCore {
table-layout: fixed;
width: 100% !important;
th,
td {
box-sizing: border-box;
padding: 7px 16px !important;
vertical-align: middle !important;
}
th {
padding: 7px 16px !important;
}
}
.ht_clone_top .wtHolder {
margin-right: 17px;
}
.recharge-thumb-empty {
min-width: 64px;
min-height: 48px;
}
.image-preview {
max-width: 100%;
max-height: 70vh;
object-fit: contain;
border-radius: 8px;
}
</style>

View File

@ -1,4 +1,10 @@
// 测试selectedInterface对象的结构和处理逻辑
const VERBOSE_SCRIPT_LOGS = process.env.DEBUG_SCRIPT_LOGS === 'true';
if (!VERBOSE_SCRIPT_LOGS) {
console.log = () => {};
console.warn = () => {};
}
console.log('Testing selectedInterface processing...\n');
// 模拟从上游接口传递过来的selectedInterface对象

View File

@ -1,4 +1,10 @@
// 测试完整的ApiTest组件流程
const VERBOSE_SCRIPT_LOGS = process.env.DEBUG_SCRIPT_LOGS === 'true';
if (!VERBOSE_SCRIPT_LOGS) {
console.log = () => {};
console.warn = () => {};
}
console.log('=== Testing Full ApiTest Flow ===\n');
// 模拟完整的selectedInterface对象(从上游接口传递过来)

View File

@ -28,49 +28,21 @@ export default defineConfig({
rewrite: (path) => path.replace(/^\/api/, ''),
timeout: 30000,
proxyTimeout: 30000,
configure: (proxy, options) => {
proxy.on('proxyReq', (proxyReq, req, res) => {
console.log('[UPLOAD] Sending Request:', req.method, req.url);
console.log('[UPLOAD] Proxy Target:', proxyReq.path);
});
proxy.on('proxyRes', (proxyRes, req, res) => {
console.log('[UPLOAD] Received Response:', proxyRes.statusCode, req.url);
});
},
},
// 权限(admin)43.139.210.35:5281 -> http://api.nanafa.com/admin(路径保持 /rbac/xxx -> .../admin/rbac/xxx)
'/rbac': {
target: 'http://api.nanafa.com/admin',
changeOrigin: true,
secure: false,
configure: (proxy, options) => {
proxy.on('proxyReq', (proxyReq, req, res) => {
console.log('[RBAC-5281] Sending Request:', req.method, req.url);
console.log('[RBAC-5281] Target Path:', proxyReq.path);
});
proxy.on('proxyRes', (proxyRes, req, res) => {
console.log(
'[RBAC-5281] Received Response:',
proxyRes.statusCode,
req.url
);
});
},
},
// 轨迹(track)43.139.210.35:8889 -> http://api.nanafa.com/track,路径与 rbac、api 一致:/Track/xxx
'/Track': {
target: 'http://api.nanafa.com',
changeOrigin: true,
rewrite: (path) => '/track' + path,
configure: (proxy, options) => {
configure: (proxy) => {
proxy.on('error', (err, req, res) => {
console.log('proxy error', err);
});
proxy.on('proxyReq', (proxyReq, req, res) => {
console.log('[Track] Sending Request:', req.method, req.url);
});
proxy.on('proxyRes', (proxyRes, req, res) => {
console.log('[Track] Received Response:', proxyRes.statusCode, req.url);
console.error('proxy error', err);
});
},
},
@ -82,20 +54,6 @@ export default defineConfig({
rewrite: (path) => path.replace(/^\/api/, ''),
timeout: 30000,
proxyTimeout: 30000,
configure: (proxy, options) => {
proxy.on('proxyReq', (proxyReq, req, res) => {
console.log('[8888] Sending Request:', req.method, req.url);
console.log('[8888] Proxy Target:', proxyReq.path);
});
proxy.on('proxyRes', (proxyRes, req, res) => {
console.log(
'[8888] Received Response:',
proxyRes.statusCode,
req.url
);
});
},
},
// 外部域名(用于 ApiTest 调试,避免浏览器 CORS)
@ -203,7 +161,6 @@ export default defineConfig({
});
if (isFrontendRoute) {
console.log('[Vite Middleware] Intercepting frontend route:', url);
// 标记请求,让代理中间件知道不要代理
(req as any).__skipProxy = true;
(req as any).__isFrontendRoute = true;
@ -219,7 +176,6 @@ export default defineConfig({
const pathAfterApi = url.substring(5); // 去掉 '/api/'
// 如果路径包含大写字母(驼峰命名),很可能是前端路由
if (/[A-Z]/.test(pathAfterApi)) {
console.log('[Vite Middleware] Detected camelCase route (likely frontend):', url);
(req as any).__skipProxy = true;
(req as any).__isFrontendRoute = true;
next();