refactor(前端商品管理): 改用表格形式

This commit is contained in:
2026-07-11 23:08:09 +08:00
parent d207486a7c
commit ac2b5a2821
2 changed files with 509 additions and 337 deletions
@@ -0,0 +1,196 @@
<script lang="ts" setup>
import type { ProductVO } from '#/api/ecommerce/product/types';
import { computed, ref } from 'vue';
import { useRouter } from 'vue-router';
import { useVbenModal } from '@vben/common-ui';
import { createIconifyIcon } from '@vben/icons';
import { Button, Image, Space, Table } from 'ant-design-vue';
defineOptions({ name: 'ProductDetailModal' });
const ChartIcon = createIconifyIcon('lucide:line-chart');
const EditIcon = createIconifyIcon('lucide:square-pen');
const ImageIcon = createIconifyIcon('lucide:image');
const product = ref<ProductVO.Info | null>(null);
const router = useRouter();
const emit = defineEmits<{
edit: [product: ProductVO.Info];
}>();
/** 金额展示 */
const formatCost = (val?: number) => `¥${(val ?? 0).toFixed(2)}`;
const specDataSource = computed(() => product.value?.specs ?? []);
const specColumns = [
{
title: '规格编码',
dataIndex: 'specCode',
key: 'specCode',
width: 140,
customRender: ({ text }: { text?: string }) => text || '-',
},
{
title: '规格名称',
dataIndex: 'name',
key: 'name',
ellipsis: true,
},
{
title: '商品成本',
dataIndex: 'productCost',
key: 'productCost',
width: 110,
customRender: ({ record }: { record: ProductVO.SpecInfo }) =>
formatCost(record.productCost),
},
{
title: '运费成本',
dataIndex: 'shippingCost',
key: 'shippingCost',
width: 110,
customRender: ({ record }: { record: ProductVO.SpecInfo }) =>
formatCost(record.shippingCost),
},
{
title: '其他成本',
dataIndex: 'otherCost',
key: 'otherCost',
width: 110,
customRender: ({ record }: { record: ProductVO.SpecInfo }) =>
formatCost(record.otherCost),
},
{
title: '备注',
dataIndex: 'remark',
key: 'remark',
ellipsis: true,
customRender: ({ text }: { text?: string }) => text || '-',
},
];
const [Modal, modalApi] = useVbenModal({
title: '商品详情',
class: 'w-[920px] max-w-[calc(100vw-2rem)]',
draggable: true,
showConfirmButton: false,
showCancelButton: false,
footer: false,
});
/** 打开详情模态框 */
function open(record: ProductVO.Info) {
product.value = record;
modalApi.setState({
title: `商品详情 - ${record.name}`,
});
modalApi.open();
}
/** 跳转经营统计 */
function goOverview() {
if (!product.value) return;
router.push(`/ecom/product/overview/${product.value.id}`);
modalApi.close();
}
/** 编辑商品 */
function handleEdit() {
if (!product.value) return;
const current = product.value;
modalApi.close();
emit('edit', current);
}
defineExpose({
open,
});
</script>
<template>
<Modal>
<div v-if="product" class="space-y-5">
<!-- 商品基础信息 -->
<div
class="flex flex-col gap-4 rounded-xl border border-slate-200 bg-slate-50/80 p-4 sm:flex-row sm:items-start dark:border-[hsl(240deg_3.7%_22%)] dark:bg-[hsl(222.34deg_10.43%_14%)]"
>
<div
class="flex h-[120px] w-[120px] shrink-0 items-center justify-center overflow-hidden rounded-lg border border-slate-200 bg-white dark:border-[hsl(240deg_3.7%_22%)] dark:bg-[hsl(222.34deg_10.43%_12.27%)]"
>
<Image
v-if="product.mainImage"
:src="product.mainImage"
:width="120"
:height="120"
class="object-cover"
:preview="true"
/>
<ImageIcon
v-else
class="h-10 w-10 text-slate-300 dark:text-[hsl(240deg_5%_45%)]"
/>
</div>
<div class="min-w-0 flex-1 space-y-2 text-sm">
<div class="text-lg font-semibold text-slate-900 dark:text-[hsl(0deg_0%_95%)]">
{{ product.name }}
</div>
<div class="grid gap-2 sm:grid-cols-2">
<div>
<span class="text-slate-500 dark:text-[hsl(240deg_5%_64.9%)]">商品编码:</span>
<span>{{ product.productCode || '-' }}</span>
</div>
<div>
<span class="text-slate-500 dark:text-[hsl(240deg_5%_64.9%)]">商品类目:</span>
<span>{{ product.categoryName || '-' }}</span>
</div>
<div>
<span class="text-slate-500 dark:text-[hsl(240deg_5%_64.9%)]">规格数量:</span>
<span>{{ product.specs?.length ?? 0 }}</span>
</div>
<div>
<span class="text-slate-500 dark:text-[hsl(240deg_5%_64.9%)]">创建时间:</span>
<span>{{ product.createTime || '-' }}</span>
</div>
</div>
</div>
</div>
<!-- 规格明细表 -->
<div>
<div class="mb-3 text-base font-medium text-slate-900 dark:text-[hsl(0deg_0%_95%)]">
规格明细
</div>
<Table
:columns="specColumns"
:data-source="specDataSource"
:pagination="false"
row-key="id"
size="small"
bordered
:scroll="{ x: 760 }"
/>
</div>
<div class="flex justify-end border-t border-slate-200 pt-4 dark:border-[hsl(240deg_3.7%_22%)]">
<Space>
<Button @click="modalApi.close()">关闭</Button>
<Button @click="goOverview">
<ChartIcon class="mr-1 h-4 w-4" />
经营统计
</Button>
<Button type="primary" @click="handleEdit">
<EditIcon class="mr-1 h-4 w-4" />
编辑商品
</Button>
</Space>
</div>
</div>
</Modal>
</template>
@@ -1,29 +1,43 @@
<script lang="ts" setup>
import type { VxeGridProps } from '#/adapter/vxe-table';
import type { ProductDTO, ProductVO } from '#/api/ecommerce/product/types';
import type { PageQueryDTO } from '#/types/common';
import { nextTick, onMounted, onUnmounted, ref } from 'vue';
import { Waterfall } from 'vue-waterfall-plugin-next';
import 'vue-waterfall-plugin-next/dist/style.css';
import { computed, ref } from 'vue';
import { useRouter } from 'vue-router';
import { Page } from '@vben/common-ui';
import { createIconifyIcon } from '@vben/icons';
import { Button, Card, Empty, message, Spin } from 'ant-design-vue';
import { Button, Image, message, Popconfirm, Space, Tag } from 'ant-design-vue';
import { useVbenForm } from '#/adapter/form';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { deleteProductApi, getProductPageApi } from '#/api/ecommerce/product';
import ProductCard from './components/ProductCard.vue';
import ProductDetailModal from './components/ProductDetailModal.vue';
import ProductFormModal from './components/ProductFormModal.vue';
defineOptions({ name: 'ProductManagement' });
const PlusIcon = createIconifyIcon('lucide:plus');
const RefreshCwIcon = createIconifyIcon('lucide:refresh-cw');
const ChartIcon = createIconifyIcon('lucide:line-chart');
const EditIcon = createIconifyIcon('lucide:square-pen');
const ImageIcon = createIconifyIcon('lucide:image');
const productFormModalRef = ref();
const router = useRouter();
const loading = ref(false);
const productFormModalRef = ref<InstanceType<typeof ProductFormModal> | null>(
null,
);
const productDetailModalRef = ref<InstanceType<typeof ProductDetailModal> | null>(
null,
);
/** 列表行内最多展示的规格编码标签数 */
const MAX_SPEC_CODE_TAGS = 4;
// 搜索条件
const searchForm = ref({
name: '',
productCode: '',
@@ -31,26 +45,173 @@ const searchForm = ref({
specName: '',
});
const searchFormSubmitRef = ref<null | (() => Promise<unknown>)>(null);
/** 提取规格编码列表 */
function getSpecCodes(row: ProductVO.Info): string[] {
return (row.specs || [])
.map((spec) => spec.specCode?.trim())
.filter((code): code is string => !!code);
}
const [SearchForm, formApi] = useVbenForm({
commonConfig: {
componentProps: {
class: 'w-full',
/** 列表规格编码预览 */
function getSpecCodePreview(row: ProductVO.Info) {
const codes = getSpecCodes(row);
return {
visible: codes.slice(0, MAX_SPEC_CODE_TAGS),
rest: Math.max(codes.length - MAX_SPEC_CODE_TAGS, 0),
empty: codes.length === 0,
};
}
// VbenVxeGrid 表格配置(行高高于订单表,便于展示商品图)
const gridOptions: VxeGridProps<ProductVO.Info> = {
columns: [
{
type: 'seq' as const,
minWidth: 'auto',
title: '序号',
},
{
title: '商品信息',
minWidth: 260,
showOverflow: false,
slots: { default: 'productInfo' },
},
{
field: 'productCode',
title: '商品编码',
minWidth: 140,
showOverflow: 'tooltip' as const,
},
{
field: 'categoryName',
title: '类目',
minWidth: 120,
showOverflow: 'tooltip' as const,
},
{
title: '规格编码',
minWidth: 200,
showOverflow: false,
slots: { default: 'specCodes' },
},
{
title: '规格数',
minWidth: 80,
slots: { default: 'specCount' },
},
{
field: 'createTime',
title: '创建时间',
minWidth: 170,
showOverflow: 'tooltip' as const,
},
{
title: '操作',
minWidth: 200,
fixed: 'right' as const,
slots: { default: 'action' },
},
],
height: 'auto',
border: true,
stripe: true,
// 商品行需要更高以容纳主图
rowConfig: {
isHover: true,
height: 88,
},
showOverflow: true,
size: 'small',
toolbarConfig: {
custom: true,
refresh: true,
zoom: true,
},
data: [],
pagerConfig: {
enabled: true,
pageSize: 20,
pageSizes: [10, 20, 50, 100],
layouts: [
'PrevJump',
'PrevPage',
'Number',
'NextPage',
'NextJump',
'Sizes',
'FullJump',
'Total',
] as (
| 'FullJump'
| 'NextJump'
| 'NextPage'
| 'Number'
| 'PrevJump'
| 'PrevPage'
| 'Sizes'
| 'Total'
)[],
},
proxyConfig: {
ajax: {
query: async ({ page, form }) => {
try {
loading.value = true;
const searchParams = form || {};
const filters: ProductDTO.Filters = {
name:
String(searchParams.name ?? searchForm.value.name ?? '').trim() ||
undefined,
productCode:
String(
searchParams.productCode ?? searchForm.value.productCode ?? '',
).trim() || undefined,
specCode:
String(searchParams.specCode ?? searchForm.value.specCode ?? '').trim() ||
undefined,
specName:
String(searchParams.specName ?? searchForm.value.specName ?? '').trim() ||
undefined,
};
const params: PageQueryDTO<ProductDTO.Filters> = {
page: page.currentPage,
pageSize: page.pageSize,
filters,
};
const data = await getProductPageApi(params);
return {
items: data.records,
total: data.total,
};
} catch (error) {
console.error('获取商品列表失败:', error);
message.error('获取商品列表失败');
return {
items: [],
total: 0,
};
} finally {
loading.value = false;
}
},
},
},
handleReset: handleSearchFormReset,
handleSubmit: handleSearchFormSubmit,
layout: 'horizontal',
};
const gridReloadRef = ref<(() => void) | null>(null);
const formOptions = computed(() => ({
schema: [
{
component: 'Input',
componentProps: {
placeholder: '请输入商品名称(回车搜索)',
allowClear: true,
onPressEnter: () => void searchFormSubmitRef.value?.(),
onChange: (e: Event) => {
searchForm.value.name = (e.target as HTMLInputElement).value;
},
onPressEnter: () => gridReloadRef.value?.(),
},
defaultValue: '',
fieldName: 'name',
label: '商品名称',
},
@@ -59,9 +220,11 @@ const [SearchForm, formApi] = useVbenForm({
componentProps: {
placeholder: '请输入商品编码(回车搜索)',
allowClear: true,
onPressEnter: () => void searchFormSubmitRef.value?.(),
onChange: (e: Event) => {
searchForm.value.productCode = (e.target as HTMLInputElement).value;
},
onPressEnter: () => gridReloadRef.value?.(),
},
defaultValue: '',
fieldName: 'productCode',
label: '商品编码',
},
@@ -70,9 +233,11 @@ const [SearchForm, formApi] = useVbenForm({
componentProps: {
placeholder: '请输入规格名称(回车搜索)',
allowClear: true,
onPressEnter: () => void searchFormSubmitRef.value?.(),
onChange: (e: Event) => {
searchForm.value.specName = (e.target as HTMLInputElement).value;
},
onPressEnter: () => gridReloadRef.value?.(),
},
defaultValue: '',
fieldName: 'specName',
label: '规格名称',
},
@@ -81,373 +246,184 @@ const [SearchForm, formApi] = useVbenForm({
componentProps: {
placeholder: '请输入规格编码(回车搜索)',
allowClear: true,
onPressEnter: () => void searchFormSubmitRef.value?.(),
onChange: (e: Event) => {
searchForm.value.specCode = (e.target as HTMLInputElement).value;
},
onPressEnter: () => gridReloadRef.value?.(),
},
defaultValue: '',
fieldName: 'specCode',
label: '规格编码',
},
],
showCollapseButton: false,
showDefaultActions: true,
submitButtonOptions: {
content: '搜索',
},
resetButtonOptions: {
content: '重置',
},
collapsed: false,
submitOnEnter: true,
wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3',
}));
const [Grid, gridApi] = useVbenVxeGrid({
gridOptions,
formOptions: formOptions.value,
showSearchForm: true,
tableTitle: '商品管理',
});
searchFormSubmitRef.value = () => formApi.validateAndSubmitForm();
gridReloadRef.value = () => gridApi.reload();
async function handleSearchFormSubmit(values: Record<string, any>) {
searchForm.value = {
name: String(values.name ?? '').trim(),
productCode: String(values.productCode ?? '').trim(),
specCode: String(values.specCode ?? '').trim(),
specName: String(values.specName ?? '').trim(),
};
runSearch();
function refreshTable() {
gridApi.reload();
}
async function handleSearchFormReset() {
await formApi.resetForm();
searchForm.value = {
name: '',
productCode: '',
specCode: '',
specName: '',
};
runSearch();
function handleAdd() {
productFormModalRef.value?.open(false);
}
const loading = ref(false);
const refreshLoading = ref(false);
const productList = ref<ProductVO.Info[]>([]);
const total = ref(0);
const current = ref(1);
const pageSize = ref(24);
const hasMore = ref(true);
const scrollContainerRef = ref<HTMLElement | null>(null);
const waterfallRef = ref();
const loadProductList = async (reset = false) => {
if (loading.value || (!hasMore.value && !reset)) return;
loading.value = true;
try {
const params: PageQueryDTO<ProductDTO.Filters> = {
page: current.value,
pageSize: pageSize.value,
filters: {
name: searchForm.value.name || undefined,
productCode: searchForm.value.productCode || undefined,
specCode: searchForm.value.specCode || undefined,
specName: searchForm.value.specName || undefined,
},
};
const response = await getProductPageApi(params);
if (reset) {
productList.value = response.records;
} else {
productList.value.push(...response.records);
}
total.value = response.total;
if (productList.value.length >= response.total) {
hasMore.value = false;
} else {
current.value++;
hasMore.value = true;
}
} catch {
message.error('加载商品列表失败');
} finally {
loading.value = false;
}
};
function runSearch() {
current.value = 1;
productList.value = [];
hasMore.value = true;
loadProductList(true);
function handleEdit(record: ProductVO.Info) {
productFormModalRef.value?.open(true, record);
}
const handleScroll = () => {
const container = scrollContainerRef.value;
if (!container || loading.value || !hasMore.value) return;
/** 打开商品详情模态框 */
function openProductDetail(record: ProductVO.Info) {
productDetailModalRef.value?.open(record);
}
const { scrollTop, scrollHeight, clientHeight } = container;
if (scrollTop + clientHeight >= scrollHeight - 200) {
loadProductList();
}
};
function goToOverview(record: ProductVO.Info) {
router.push(`/ecom/product/overview/${record.id}`);
}
async function handleDelete(record: ProductVO.Info) {
try {
await deleteProductApi(record.id);
message.success('删除成功');
refreshTable();
} catch (error) {
console.error('删除商品失败:', error);
message.error('删除商品失败');
}
}
async function refreshTable(updatedProduct?: ProductVO.Info) {
if (updatedProduct) {
const index = productList.value.findIndex((p) => p.id === updatedProduct.id);
if (index !== -1) {
productList.value[index] = updatedProduct;
}
return;
}
current.value = 1;
productList.value = [];
hasMore.value = true;
await loadProductList(true);
}
async function handleRefresh() {
refreshLoading.value = true;
try {
await refreshTable();
} finally {
refreshLoading.value = false;
}
}
const handleEditingChange = async () => {
await nextTick();
await nextTick();
if (waterfallRef.value) {
waterfallRef.value.renderer();
}
};
function handleAdd() {
productFormModalRef.value?.open(false);
}
function handleModalSuccess() {
refreshTable();
}
onMounted(() => {
loadProductList(true);
setTimeout(() => {
if (scrollContainerRef.value) {
scrollContainerRef.value.addEventListener('scroll', handleScroll);
}
}, 100);
});
onUnmounted(() => {
if (scrollContainerRef.value) {
scrollContainerRef.value.removeEventListener('scroll', handleScroll);
}
});
function handleDetailEdit(record: ProductVO.Info) {
handleEdit(record);
}
</script>
<template>
<Page
auto-content-height
content-class="flex min-h-0 flex-1 flex-col bg-[#f8fafc] dark:bg-[hsl(222.34deg_10.43%_12.27%)]"
header-class="product-page-header"
>
<div class="flex min-h-0 flex-1 flex-col dark:bg-[hsl(222.34deg_10.43%_12.27%)]">
<div class="flex min-h-0 flex-1 flex-col">
<Card
class="product-mgmt-search mb-4 shrink-0 rounded-2xl border border-slate-200 bg-white/90 shadow-[0_4px_12px_rgba(0,0,0,0.03)] dark:border-[hsl(240deg_3.7%_22%)] dark:bg-[hsl(222.34deg_10.43%_12.27%)] dark:shadow-none"
:body-style="{ padding: '16px' }"
>
<SearchForm />
</Card>
<Page auto-content-height>
<Grid :loading="loading" class="product-grid">
<template #toolbar-tools>
<Button type="primary" @click="handleAdd">
<PlusIcon class="mr-1 h-4 w-4" />
添加商品
</Button>
</template>
<!-- 主体占满剩余高度且不向外溢出;自身不滚动 -->
<!-- 商品信息:主图 + 名称,点击打开详情 -->
<template #productInfo="{ row }: { row: ProductVO.Info }">
<div
class="flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden"
class="product-info-cell flex cursor-pointer items-center gap-3"
@click="openProductDetail(row)"
>
<Card
class="product-mgmt-grid flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden rounded-2xl border border-slate-200 bg-white/90 shadow-[0_4px_12px_rgba(0,0,0,0.03)] dark:border-[hsl(240deg_3.7%_22%)] dark:bg-[hsl(222.34deg_10.43%_12.27%)] dark:shadow-none"
:body-style="{
padding: '16px',
display: 'flex',
flexDirection: 'column',
flex: '1 1 0',
minHeight: 0,
overflow: 'hidden',
}"
<div
class="flex h-16 w-16 shrink-0 items-center justify-center overflow-hidden rounded-md border border-slate-200 bg-slate-50 dark:border-[hsl(240deg_3.7%_22%)] dark:bg-[hsl(222.34deg_10.43%_14%)]"
>
<Image
v-if="row.mainImage"
:src="row.mainImage"
:width="64"
:height="64"
class="object-cover"
:preview="false"
/>
<ImageIcon
v-else
class="h-6 w-6 text-slate-300 dark:text-[hsl(240deg_5%_45%)]"
/>
</div>
<div class="min-w-0 flex-1">
<div
class="mb-3 flex shrink-0 items-center justify-between gap-3"
class="truncate text-sm font-medium text-[#1890ff] hover:underline"
>
<span class="text-sm text-gray-500 dark:text-[hsl(240deg_5%_64.9%)]">
共 {{ total }} 个商品
</span>
<div class="flex shrink-0 items-center gap-2">
<Button
shape="circle"
type="default"
title="刷新列表"
aria-label="刷新商品列表"
class="product-toolbar-refresh-btn"
:loading="refreshLoading"
@click="handleRefresh"
>
<RefreshCwIcon class="block h-4 w-4 shrink-0 leading-none" />
</Button>
<Button type="primary" @click="handleAdd">
<PlusIcon class="mr-2 h-4 w-4" />
添加商品
</Button>
</div>
{{ row.name }}
</div>
<!-- 仅列表区域滚动,用于瀑布流与触底加载 -->
<div
ref="scrollContainerRef"
class="product-mgmt-scroll flex min-h-0 min-w-0 flex-1 flex-col overflow-y-auto"
class="mt-0.5 truncate text-xs text-slate-400 dark:text-[hsl(240deg_5%_64.9%)]"
>
<Spin :spinning="loading && productList.length === 0">
<div
v-if="!loading && productList.length === 0"
class="flex min-h-[200px] items-center justify-center py-8"
>
<Empty />
</div>
<Waterfall
v-else-if="productList.length > 0"
ref="waterfallRef"
:list="productList"
row-key="id"
:horizontalOrder="true"
:width="700"
:breakpoints="{
2700: { rowPerView: 3 },
2000: { rowPerView: 2 },
1400: { rowPerView: 2 },
900: { rowPerView: 1 },
500: { rowPerView: 1 },
}"
:gutter="20"
class="product-waterfall"
>
<template #default="{ item }">
<div class="w-full">
<ProductCard
:product="item"
@updated="(p) => refreshTable(p)"
@delete="handleDelete"
@editing-change="handleEditingChange"
@layout-change="handleEditingChange"
/>
</div>
</template>
</Waterfall>
<div
v-if="productList.length > 0"
class="mt-4 flex justify-center py-4"
>
<Spin v-if="loading" />
<div
v-else-if="!hasMore"
class="text-sm text-gray-500 dark:text-[hsl(240deg_5%_64.9%)]"
>
没有更多商品了
</div>
</div>
</Spin>
点击查看详情
</div>
</Card>
</div>
</div>
</div>
</div>
</template>
<!-- 规格编码预览,点击同样打开详情 -->
<template #specCodes="{ row }: { row: ProductVO.Info }">
<div
class="spec-codes-cell flex cursor-pointer flex-wrap items-center gap-1"
@click="openProductDetail(row)"
>
<template v-if="!getSpecCodePreview(row).empty">
<Tag
v-for="code in getSpecCodePreview(row).visible"
:key="code"
class="m-0"
>
{{ code }}
</Tag>
<Tag v-if="getSpecCodePreview(row).rest > 0" class="m-0">
+{{ getSpecCodePreview(row).rest }}
</Tag>
</template>
<span v-else class="text-slate-400">-</span>
</div>
</template>
<template #specCount="{ row }: { row: ProductVO.Info }">
{{ row.specs?.length ?? 0 }}
</template>
<template #action="{ row }: { row: ProductVO.Info }">
<Space :size="4">
<Button type="link" size="small" @click="openProductDetail(row)">
详情
</Button>
<Button type="link" size="small" @click="handleEdit(row)">
<EditIcon class="mr-0.5 h-3.5 w-3.5" />
编辑
</Button>
<Button type="link" size="small" @click="goToOverview(row)">
<ChartIcon class="mr-0.5 h-3.5 w-3.5" />
统计
</Button>
<Popconfirm
title="确定删除该商品吗?删除后不可恢复。"
ok-text="确定删除"
cancel-text="取消"
@confirm="handleDelete(row)"
>
<Button type="link" size="small" danger>删除</Button>
</Popconfirm>
</Space>
</template>
</Grid>
<ProductFormModal ref="productFormModalRef" @success="handleModalSuccess" />
<ProductDetailModal
ref="productDetailModalRef"
@edit="handleDetailEdit"
/>
</Page>
</template>
<style scoped>
.line-clamp-2 {
display: -webkit-box;
-webkit-line-clamp: 2;
line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
/* 商品表行高与单元格垂直居中 */
:deep(.product-grid .vxe-body--column) {
vertical-align: middle;
}
.product-waterfall {
background-color: transparent !important;
}
/* 圆形图标按钮:内容垂直水平居中(抵消 iconify 行高/基线偏移) */
.product-toolbar-refresh-btn.ant-btn {
display: inline-flex !important;
align-items: center;
justify-content: center;
padding: 0;
}
.product-toolbar-refresh-btn.ant-btn :deep(svg) {
display: block;
}
@media (max-width: 640px) {
:deep(.product-page-header) {
flex-direction: column;
align-items: stretch;
gap: 10px;
}
:deep(.product-page-header > div:first-child) {
width: 100%;
}
:deep(.product-page-header > div:last-child) {
width: 100%;
}
}
</style>
<!-- 深色:无 scoped + Vben 设计令牌,保证 Ant Card 穿透 -->
<style>
html.dark .product-mgmt-search.ant-card,
html.dark .product-mgmt-grid.ant-card {
background-color: hsl(var(--card)) !important;
border-color: hsl(var(--border)) !important;
}
html.dark .product-mgmt-search.ant-card .ant-card-body,
html.dark .product-mgmt-grid.ant-card .ant-card-body {
background-color: hsl(var(--card)) !important;
}
html.dark .product-mgmt-search .ant-form-item-label > label {
color: hsl(var(--muted-foreground));
}
html.dark .product-mgmt-search .ant-input,
html.dark .product-mgmt-search .ant-input-affix-wrapper,
html.dark .product-mgmt-search .ant-select-selector {
background-color: hsl(var(--input-background)) !important;
border-color: hsl(var(--border)) !important;
color: hsl(var(--foreground)) !important;
}
html.dark .product-mgmt-search .ant-btn-default {
background-color: hsl(var(--secondary));
border-color: hsl(var(--border));
color: hsl(var(--foreground));
}
html.dark .product-mgmt-scroll .ant-empty-description {
color: hsl(var(--muted-foreground));
.product-info-cell,
.spec-codes-cell {
min-height: 64px;
}
</style>