|
@@ -1,15 +1,60 @@ |
|
|
import { Space, Table, Button, Image, Divider, Badge } from 'antd'; |
|
|
|
|
|
import type { TableColumnsType } from 'antd'; |
|
|
|
|
|
|
|
|
import { Space, Table, Button, Image, Divider, Badge, Card, Input, Select, DatePicker, Cascader } from 'antd'; |
|
|
|
|
|
import type { TableColumnsType, DatePickerProps } from 'antd'; |
|
|
import { t } from '@/utils/i18n'; |
|
|
import { t } from '@/utils/i18n'; |
|
|
import React, { useState } from 'react'; |
|
|
import React, { useState } from 'react'; |
|
|
import mData from '../../../../../mock/productListPage.json' |
|
|
import mData from '../../../../../mock/productListPage.json' |
|
|
import { PlusOutlined, ExclamationCircleFilled } from '@ant-design/icons'; |
|
|
|
|
|
|
|
|
import { PlusOutlined, ExclamationCircleFilled, SearchOutlined,UndoOutlined } from '@ant-design/icons'; |
|
|
import type { Product, ProductBase, ProductImage, ProductSku } from '@/models' |
|
|
import type { Product, ProductBase, ProductImage, ProductSku } from '@/models' |
|
|
import { antdUtils } from '@/utils/antd'; |
|
|
import { antdUtils } from '@/utils/antd'; |
|
|
|
|
|
import customParseFormat from 'dayjs/plugin/customParseFormat'; |
|
|
|
|
|
|
|
|
|
|
|
import dayjs from 'dayjs'; |
|
|
|
|
|
dayjs.extend(customParseFormat); |
|
|
|
|
|
|
|
|
|
|
|
const { RangePicker } = DatePicker; |
|
|
|
|
|
const dateFormat = 'YYYY/MM/DD'; |
|
|
|
|
|
|
|
|
|
|
|
const options = [ |
|
|
|
|
|
{ |
|
|
|
|
|
value: '0', |
|
|
|
|
|
label: 'SPU编码', |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
value: '1', |
|
|
|
|
|
label: '商品标题', |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
value: '2', |
|
|
|
|
|
label: '原SPU编码', |
|
|
|
|
|
}, |
|
|
|
|
|
]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
interface Option { |
|
|
|
|
|
value: string; |
|
|
|
|
|
label: string; |
|
|
|
|
|
children?: Option[]; |
|
|
|
|
|
isLeaf?: boolean; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const categoryOptions: Option[] = [ |
|
|
|
|
|
{ |
|
|
|
|
|
value: '1', |
|
|
|
|
|
label: '婚纱礼服', |
|
|
|
|
|
isLeaf: false, |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
value: '119', |
|
|
|
|
|
label: '珠宝', |
|
|
|
|
|
isLeaf: false, |
|
|
|
|
|
}, |
|
|
|
|
|
]; |
|
|
|
|
|
|
|
|
//成品 |
|
|
//成品 |
|
|
const FinishedProductPage: React.FC = () => { |
|
|
const FinishedProductPage: React.FC = () => { |
|
|
|
|
|
|
|
|
|
|
|
const [optionsList, setOptions] = useState<Option[]>(categoryOptions); |
|
|
|
|
|
|
|
|
const showDeleteConfirm = () => { |
|
|
const showDeleteConfirm = () => { |
|
|
antdUtils.modal?.confirm({ |
|
|
antdUtils.modal?.confirm({ |
|
|
title: '确认要将该商品删除吗?', |
|
|
title: '确认要将该商品删除吗?', |
|
@@ -161,22 +206,67 @@ const FinishedProductPage: React.FC = () => { |
|
|
|
|
|
|
|
|
const data: Array<Product> = mData as Array<Product>; |
|
|
const data: Array<Product> = mData as Array<Product>; |
|
|
|
|
|
|
|
|
|
|
|
const onChange = (value: (string | number)[], selectedOptions: Option[]) => { |
|
|
|
|
|
console.log(value, selectedOptions); |
|
|
|
|
|
}; |
|
|
|
|
|
const loadData = (selectedOptions: Option[]) => { |
|
|
|
|
|
const targetOption = selectedOptions[selectedOptions.length - 1]; |
|
|
|
|
|
// load options lazily |
|
|
|
|
|
setTimeout(() => { |
|
|
|
|
|
targetOption.children = [ |
|
|
|
|
|
{ |
|
|
|
|
|
label: `${targetOption.label} Dynamic 1`, |
|
|
|
|
|
value: 'dynamic1', |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
label: `${targetOption.label} Dynamic 2`, |
|
|
|
|
|
value: 'dynamic2', |
|
|
|
|
|
}, |
|
|
|
|
|
]; |
|
|
|
|
|
setOptions([...optionsList]); |
|
|
|
|
|
}, 1000); |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const onKeywordsTypeChanged = (value: string, selectedOptions: Option | Option[]) => { |
|
|
|
|
|
console.log(value, selectedOptions); |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
return ( |
|
|
return ( |
|
|
<> |
|
|
<> |
|
|
<div className='mt-[4px] dark:bg-[rgb(33,41,70)] bg-white roundle-lg px[12px]'> |
|
|
|
|
|
<div className="py-[8px]"> |
|
|
|
|
|
<Button className="ml-5" type='primary' size='middle' icon={<PlusOutlined />}> 批量操作 </Button> |
|
|
|
|
|
</div> |
|
|
|
|
|
<Table rowKey="id" |
|
|
|
|
|
scroll={{ x: true }} |
|
|
|
|
|
columns={columns} |
|
|
|
|
|
expandable={{ expandedRowRender: expandedColumnsRender, defaultExpandedRowKeys: ['0'] }} |
|
|
|
|
|
dataSource={data} |
|
|
|
|
|
className='bg-transparent' |
|
|
|
|
|
pagination={{ position: ['bottomRight'] }} /> |
|
|
|
|
|
|
|
|
<div> |
|
|
|
|
|
<Card className='mt-[4px] dark:bg-[rgb(33,41,70)] bg-white roundle-lg px[12px]' bodyStyle={{ paddingTop: 4, paddingBottom: 4 }}> |
|
|
|
|
|
<div className='flex justify-normal items-center'> |
|
|
|
|
|
<Cascader options={optionsList} style={{ width: '20%' }} loadData={loadData} onChange={onChange} placeholder="请选择商品类目" changeOnSelect/> |
|
|
|
|
|
<Space.Compact className='ml-[5px]'> |
|
|
|
|
|
<Select defaultValue="0" options={options} onChange={onKeywordsTypeChanged}/> |
|
|
|
|
|
<Input allowClear/> |
|
|
|
|
|
|
|
|
|
|
|
</Space.Compact> |
|
|
|
|
|
<RangePicker |
|
|
|
|
|
className='ml-[5px]' |
|
|
|
|
|
format={dateFormat} |
|
|
|
|
|
/> |
|
|
|
|
|
<Space.Compact> |
|
|
|
|
|
<Button className="ml-5" type='primary' size='large' icon={<SearchOutlined />}> 搜索 </Button> |
|
|
|
|
|
<Button type='primary' size='large' icon={<UndoOutlined />}> 重置 </Button> |
|
|
|
|
|
</Space.Compact> |
|
|
|
|
|
<div className="py-[4px]"> |
|
|
|
|
|
<Button className="ml-5" type='primary' size='large' icon={<PlusOutlined />}> 批量操作 </Button> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
</Card> |
|
|
|
|
|
|
|
|
|
|
|
<Card className='mt-[4px] dark:bg-[rgb(33,41,70)] bg-white roundle-lg px[12px]'> |
|
|
|
|
|
<Table rowKey="id" |
|
|
|
|
|
scroll={{ x: true }} |
|
|
|
|
|
columns={columns} |
|
|
|
|
|
expandable={{ expandedRowRender: expandedColumnsRender, defaultExpandedRowKeys: ['0'] }} |
|
|
|
|
|
dataSource={data} |
|
|
|
|
|
className='bg-transparent' |
|
|
|
|
|
pagination={{ position: ['bottomRight'] }} /> |
|
|
|
|
|
</Card> |
|
|
</div> |
|
|
</div> |
|
|
</> |
|
|
</> |
|
|
|
|
|
|
|
|
); |
|
|
); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|