小修小补

This commit is contained in:
ah--desktop
2025-09-14 23:54:22 +08:00
parent 1ac8445a90
commit 2b750585d1
51 changed files with 3611 additions and 505 deletions
@@ -1,15 +1,21 @@
<template>
<div class="p-6">
<VbenCard title="数据分析">
<Card title="数据分析" class="mb-6">
<div class="text-center py-12">
<VbenIcon icon="lucide:bar-chart-3" class="w-16 h-16 mx-auto text-gray-400 mb-4" />
<BarChartIcon class="w-16 h-16 mx-auto text-gray-400 mb-4" />
<h3 class="text-lg font-medium text-gray-700 mb-2">数据分析功能</h3>
<p class="text-gray-500">此功能正在开发中,敬请期待...</p>
</div>
</VbenCard>
</Card>
</div>
</template>
<script setup lang="ts">
// 数据分析页面占位
import { Card } from 'ant-design-vue';
import { createIconifyIcon } from '@vben/icons';
// 创建图标组件
const BarChartIcon = createIconifyIcon('lucide:bar-chart-3');
defineOptions({ name: 'DataAnalysis' });
</script>
@@ -3,7 +3,7 @@
<!-- 字段映射说明 -->
<div class="bg-blue-50 border border-blue-200 rounded-lg p-4">
<div class="flex items-start space-x-2">
<VbenIcon icon="lucide:info" class="w-5 h-5 text-blue-500 mt-0.5" />
<InfoIcon class="w-5 h-5 text-blue-500 mt-0.5" />
<div>
<p class="font-medium text-blue-800">字段映射说明</p>
<p class="text-sm text-blue-600 mt-1">
@@ -40,21 +40,25 @@
<!-- 操作按钮 -->
<div class="flex justify-end space-x-3 pt-4 border-t">
<VbenButton @click="$emit('cancel')">
<Button @click="$emit('cancel')">
取消
</VbenButton>
<VbenButton @click="handleExport" type="primary">
</Button>
<Button @click="handleExport" type="primary">
导出JSON
</VbenButton>
</Button>
</div>
</div>
</template>
<script setup lang="ts">
import { ref, computed, watch, h } from 'vue'
import { message, Table } from 'ant-design-vue'
import { message, Table, Button } from 'ant-design-vue'
import { createIconifyIcon } from '@vben/icons'
import { transformDataWithMapping, generateExportData, downloadJSON } from '#/utils/csv-utils'
// 创建图标组件
const InfoIcon = createIconifyIcon('lucide:info')
// Props
interface Props {
csvHeaders: string[]
@@ -1,6 +1,6 @@
<template>
<div class="p-6">
<VbenCard title="电商数据导入" class="mb-6">
<Card title="电商数据导入" class="mb-6">
<div class="space-y-6">
<!-- 文件拖拽上传区域 -->
<div
@@ -11,14 +11,14 @@
@drop.prevent="handleDrop"
>
<div class="space-y-4">
<VbenIcon icon="lucide:upload" class="w-12 h-12 mx-auto text-gray-400" />
<UploadIcon class="w-12 h-12 mx-auto text-gray-400" />
<div>
<p class="text-lg font-medium text-gray-700">拖拽CSV文件到此处或点击上传</p>
<p class="text-sm text-gray-500">支持.csv格式,最大10MB</p>
</div>
<VbenButton @click="triggerFileInput" type="primary" ghost>
<Button @click="triggerFileInput" type="primary" ghost>
选择文件
</VbenButton>
</Button>
</div>
<input
ref="fileInputRef"
@@ -33,19 +33,19 @@
<div v-if="uploadedFile" class="bg-green-50 border border-green-200 rounded-lg p-4">
<div class="flex items-center justify-between">
<div class="flex items-center space-x-2">
<VbenIcon icon="lucide:check-circle" class="w-5 h-5 text-green-500" />
<CheckCircleIcon class="w-5 h-5 text-green-500" />
<span class="font-medium text-green-800">文件上传成功</span>
</div>
<VbenButton @click="clearData" size="small" type="text" danger>
<Button @click="clearData" size="small" type="text" danger>
清除数据
</VbenButton>
</Button>
</div>
<p class="text-sm text-green-600 mt-1">{{ uploadedFile.name }} ({{ formatFileSize(uploadedFile.size) }})</p>
</div>
<!-- 实体匹配结果 -->
<div v-if="matchingResult" class="space-y-4">
<VbenCard title="实体匹配结果">
<Card title="实体匹配结果">
<div class="grid grid-cols-1 md:grid-cols-3 gap-4 mb-4">
<div class="bg-green-50 border border-green-200 rounded-lg p-4">
<div class="text-green-800 font-medium">匹配成功</div>
@@ -67,24 +67,24 @@
</div>
<div class="flex items-center space-x-2">
<VbenButton
<Button
@click="performImport"
type="primary"
:loading="importLoading"
:disabled="matchingResult.matchedOrders.length === 0"
>
开始导入 ({{ matchingResult.matchedOrders.length }})
</VbenButton>
<VbenButton @click="performEntityMatching" size="small">
</Button>
<Button @click="performEntityMatching" size="small">
重新匹配
</VbenButton>
</Button>
</div>
<!-- 导入进度 -->
<div v-if="importLoading" class="mt-4">
<Progress :percent="importProgress" />
</div>
</VbenCard>
</Card>
</div>
<!-- 数据表格 -->
@@ -97,15 +97,15 @@
</div>
</div>
<div class="flex items-center space-x-2">
<VbenButton @click="selectAll" size="small">
<Button @click="selectAll" size="small">
全选
</VbenButton>
<VbenButton @click="clearSelection" size="small">
</Button>
<Button @click="clearSelection" size="small">
清空选择
</VbenButton>
<VbenButton @click="showFieldMapping = true" type="primary" :disabled="selectedRows.length === 0">
</Button>
<Button @click="showFieldMapping = true" type="primary" :disabled="selectedRows.length === 0">
配置字段映射 ({{ selectedRows.length }})
</VbenButton>
</Button>
</div>
</div>
@@ -115,20 +115,20 @@
@checkbox-all="handleCheckboxAll"
>
<template #action="{ row }">
<VbenButton size="small" @click="handleEditRow(row)">
<Button size="small" @click="handleEditRow(row)">
编辑
</VbenButton>
<VbenButton size="small" type="primary" @click="handleMatchRow(row)">
</Button>
<Button size="small" type="primary" @click="handleMatchRow(row)">
匹配
</VbenButton>
</Button>
</template>
</Grid>
</div>
</div>
</VbenCard>
</Card>
<!-- 字段映射弹窗 -->
<VbenModal
<Modal
v-model:open="showFieldMapping"
title="字段映射配置"
width="1000px"
@@ -140,7 +140,7 @@
@confirm="handleFieldMapping"
@cancel="showFieldMapping = false"
/>
</VbenModal>
</Modal>
<!-- 实体创建模态框 -->
<EntityCreationModal
@@ -155,7 +155,8 @@
<script setup lang="ts">
import { ref } from 'vue'
import { message, Progress } from 'ant-design-vue'
import { message, Progress, Card, Button, Modal } from 'ant-design-vue'
import { createIconifyIcon } from '@vben/icons'
import FieldMapping from '#/views/ecommerce/data-import/components/FieldMapping.vue'
import EntityCreationModal from './components/EntityCreationModal.vue'
import { EntityMatchingService, type EntityMatchingResult } from './services/EntityMatchingService'
@@ -164,6 +165,10 @@ import { parseOrderCSV, extractShopNameFromFilename, convertToCSVOrderData } fro
import { useVbenVxeGrid } from '#/adapter/vxe-table'
import type { VxeGridProps } from '#/adapter/vxe-table'
// 创建图标组件
const UploadIcon = createIconifyIcon('lucide:upload')
const CheckCircleIcon = createIconifyIcon('lucide:check-circle')
// 响应式数据
const uploadedFile = ref<File | null>(null)
const csvData = ref<any[]>([])
@@ -8,9 +8,9 @@ import {
getProductsByNamesApi,
getProductSpecsByProductAndSpecsApi,
type ShopVO,
type ProductVO,
type OrderDTO
} from '#/api/ecommerce';
type ProductVO
} from '#/api/shop';
import { type OrderDTO } from '#/api/ecommerce';
export interface EntityMatchingResult {
/** 匹配成功的订单数据 */
@@ -1,7 +1,7 @@
<script lang="ts" setup>
import { Card, Image, Tag, Button, Space, Popconfirm, Tooltip } from 'ant-design-vue';
import { createIconifyIcon } from '@vben/icons';
import type { ProductVO } from '#/api/ecommerce';
import type { ProductVO } from '#/api/shop';
// 创建图标组件
const EditIcon = createIconifyIcon('lucide:edit');
@@ -152,7 +152,7 @@ import {
createProductWithSpecsApi,
type ProductVO,
type ProductDTO
} from '#/api/ecommerce';
} from '#/api/shop';
import { uploadImageApi } from '#/api/media';
interface Emits {
@@ -97,7 +97,7 @@ import {
deleteProductSpecApi,
type ProductVO,
type ProductDTO
} from '#/api/ecommerce';
} from '#/api/shop';
import type { PageQueryDTO } from '#/types/common';
interface Emits {
@@ -168,7 +168,7 @@ import {
getProductPageApi,
type ProductVO,
type ProductDTO
} from '#/api/ecommerce';
} from '#/api/shop';
import type { PageQueryDTO } from '#/types/common';
import ProductFormModal from './components/ProductFormModal.vue';
// @ts-ignore
@@ -82,7 +82,7 @@ import {
updateShopApi,
type ShopVO,
type ShopDTO
} from '#/api/ecommerce';
} from '#/api/shop';
interface Emits {
(e: 'success'): void;
@@ -11,7 +11,7 @@ import {
updateShopApi,
type ShopVO ,
type ShopDTO
} from '#/api/ecommerce';
} from '#/api/shop';
import type { PageQueryDTO } from '#/types/common';
import ShopFormModal from './components/ShopFormModal.vue';