refactor: 重构电商模块目录结构

This commit is contained in:
ah--desktop
2025-12-07 23:02:48 +08:00
parent d3d9fd47d8
commit 407c650973
43 changed files with 669 additions and 9 deletions
@@ -76,6 +76,7 @@ const gridOptions: VxeGridProps<any> = {
height: 'auto',
border: true,
stripe: true,
highlightHoverRow: true,
showOverflow: true,
size: 'small',
toolbarConfig: {
@@ -89,6 +89,7 @@ const gridOptions: VxeGridProps<any> = {
height: 'auto',
border: true,
stripe: true,
highlightHoverRow: true,
showOverflow: true,
size: 'small',
toolbarConfig: {
@@ -56,6 +56,7 @@ const gridOptions: VxeGridProps<any> = {
height: 'auto',
border: true,
stripe: true,
highlightHoverRow: true,
showOverflow: true,
size: 'small',
data: [],
@@ -83,18 +84,47 @@ const gridOptions: VxeGridProps<any> = {
| 'Total'
)[],
},
// 配置远程加载,实现真正的分页
proxyConfig: {
ajax: {
query: async ({ page }) => {
// 如果没有数据,返回空
if (csvData.value.length === 0) {
return {
items: [],
total: 0,
};
}
// 计算分页参数
const currentPage = page.currentPage || 1;
const pageSize = page.pageSize || 50;
const startIndex = (currentPage - 1) * pageSize;
const endIndex = startIndex + pageSize;
// 从 csvData 中截取当前页的数据
const pageData = csvData.value.slice(startIndex, endIndex);
return {
items: pageData,
total: csvData.value.length,
};
},
},
},
};
const [Grid, gridApi] = useVbenVxeGrid({
gridOptions,
});
// 更新表格数据和列
// 更新表格列配置(不再更新 data,data 由 proxyConfig 管理)
const updateTable = () => {
gridApi.setGridOptions({
columns: gridColumns.value,
data: csvData.value,
});
// 触发重新加载数据
gridApi.reload();
};
// 处理文件上传
@@ -99,6 +99,7 @@ const gridOptions: VxeGridProps<any> = {
height: 'auto',
border: true,
stripe: true,
highlightHoverRow: true,
showOverflow: true,
size: 'small',
toolbarConfig: {
@@ -135,6 +135,7 @@ const gridOptions: VxeGridProps<any> = {
height: 'auto',
border: true,
stripe: true,
highlightHoverRow: true,
showOverflow: true,
size: 'small',
toolbarConfig: {
@@ -108,6 +108,7 @@ const gridOptions: VxeGridProps<any> = {
height: 'auto',
border: true,
stripe: true,
highlightHoverRow: true,
showOverflow: true,
size: 'small',
toolbarConfig: {
@@ -48,6 +48,12 @@ const gridOptions: VxeGridProps<any> = {
width: 80,
title: '序号',
},
{
title: 'Logo',
width: 100,
align: 'center' as const,
slots: { default: 'logo' },
},
{
field: 'name',
title: '店铺名称',
@@ -60,11 +66,6 @@ const gridOptions: VxeGridProps<any> = {
minWidth: 'auto',
showOverflow: 'tooltip' as const,
},
{
title: 'Logo',
minWidth: 'auto',
slots: { default: 'logo' },
},
{
field: 'createTime',
title: '创建时间',
@@ -85,6 +86,7 @@ const gridOptions: VxeGridProps<any> = {
height: 'auto',
border: true,
stripe: true,
highlightHoverRow: true,
showOverflow: true,
size: 'small',
toolbarConfig: {
@@ -242,7 +244,10 @@ function handleModalSuccess() {
<!-- Logo列 -->
<template #logo="{ row }: { row: any }">
<div v-if="row.logo">
<div
v-if="row.logo"
style="display: flex; justify-content: center; align-items: center"
>
<img
:src="row.logo"
:alt="row.name"
@@ -254,7 +259,12 @@ function handleModalSuccess() {
"
/>
</div>
<span v-else style="color: #999">暂无Logo</span>
<div
v-else
style="display: flex; justify-content: center; align-items: center"
>
<span style="color: #999">暂无Logo</span>
</div>
</template>
<!-- 操作列 -->
@@ -107,6 +107,7 @@ const gridOptions: VxeGridProps<any> = {
height: 'auto',
border: true,
stripe: true,
highlightHoverRow: true,
showOverflow: true,
size: 'small',
toolbarConfig: {
@@ -116,6 +116,7 @@ const gridOptions: VxeGridProps<any> = {
height: 'auto',
border: true,
stripe: true,
highlightHoverRow: true,
showOverflow: true,
size: 'small',
toolbarConfig: {
@@ -144,6 +144,7 @@ const gridOptions: VxeGridProps<any> = {
height: 'auto',
border: true,
stripe: true,
highlightHoverRow: true,
showOverflow: true,
size: 'small',
toolbarConfig: {
@@ -141,6 +141,7 @@ const gridOptions: VxeGridProps<any> = {
height: 'auto',
border: true,
stripe: true,
highlightHoverRow: true,
showOverflow: true,
size: 'small',
toolbarConfig: {
@@ -116,6 +116,7 @@ const gridOptions: VxeGridProps<any> = {
height: 'auto',
border: true,
stripe: true,
highlightHoverRow: true,
showOverflow: true,
size: 'small',
toolbarConfig: {
@@ -115,6 +115,7 @@ const gridOptions: VxeGridProps<any> = {
height: 'auto',
border: true,
stripe: true,
highlightHoverRow: true,
showOverflow: true,
size: 'small',
toolbarConfig: {
@@ -97,6 +97,7 @@ const gridOptions: VxeGridProps<any> = {
height: 'auto',
border: true,
stripe: true,
highlightHoverRow: true,
showOverflow: true,
size: 'small',
toolbarConfig: {
@@ -98,6 +98,7 @@ const gridOptions: VxeGridProps<any> = {
height: 'auto',
border: true,
stripe: true,
highlightHoverRow: true,
showOverflow: true,
size: 'small',
resizable: true,
@@ -98,6 +98,7 @@ const gridOptions: VxeGridProps<any> = {
height: 'auto',
border: true,
stripe: true,
highlightHoverRow: true,
showOverflow: true,
size: 'small',
resizable: true, // 启用列宽调整
@@ -134,6 +134,7 @@ const gridOptions: VxeGridProps<any> = {
height: 'auto',
border: true,
stripe: true,
highlightHoverRow: true,
showOverflow: true,
size: 'small',
toolbarConfig: {