解决我的账单页面报错 & 提交记录添加套餐号筛选
This commit is contained in:
@@ -15,6 +15,7 @@ import DatePicker from '@/components/date-picker'
|
||||
import {Button} from '@/components/ui/button'
|
||||
import {EraserIcon, SearchIcon} from 'lucide-react'
|
||||
import {pageBatch} from '@/actions/batch'
|
||||
import {Input} from '@/components/ui/input'
|
||||
|
||||
export type RecordPageProps = {}
|
||||
|
||||
@@ -34,6 +35,7 @@ export default function RecordPage(props: RecordPageProps) {
|
||||
const filterSchema = z.object({
|
||||
time_start: z.date().optional(),
|
||||
time_end: z.date().optional(),
|
||||
resource_no: z.string().optional(),
|
||||
})
|
||||
type FilterSchema = z.infer<typeof filterSchema>
|
||||
|
||||
@@ -42,6 +44,7 @@ export default function RecordPage(props: RecordPageProps) {
|
||||
defaultValues: {
|
||||
time_start: undefined,
|
||||
time_end: undefined,
|
||||
resource_no: '',
|
||||
},
|
||||
})
|
||||
|
||||
@@ -53,7 +56,9 @@ export default function RecordPage(props: RecordPageProps) {
|
||||
const result = await pageBatch({
|
||||
page,
|
||||
size,
|
||||
...filter,
|
||||
time_start: filter.time_start,
|
||||
time_end: filter.time_end,
|
||||
resource_no: filter.resource_no || undefined,
|
||||
})
|
||||
|
||||
if (result.success && result.data) {
|
||||
@@ -88,12 +93,22 @@ export default function RecordPage(props: RecordPageProps) {
|
||||
<section className="flex justify-between">
|
||||
<div></div>
|
||||
<Form form={filterForm} handler={filterHandler} className="flex-auto flex flex-wrap gap-4 items-end">
|
||||
<FormField name="resource_no" label={<span className="text-sm">套餐编号</span>}>
|
||||
{({id, field}) => (
|
||||
<Input
|
||||
{...field}
|
||||
id={id}
|
||||
className="h-9"
|
||||
value={field.value ?? ''}
|
||||
/>
|
||||
)}
|
||||
</FormField>
|
||||
<fieldset className="flex flex-col gap-2 items-start">
|
||||
<div>
|
||||
<legend className="block text-sm">提取时间</legend>
|
||||
<legend className="block text-sm">过期时间</legend>
|
||||
</div>
|
||||
<div className="flex gap-1 items-center">
|
||||
<FormField<FilterSchema, 'time_start'> name="time_start">
|
||||
<FormField<FilterSchema, 'time_start'> name="time_start" >
|
||||
{({field}) => (
|
||||
<DatePicker
|
||||
placeholder="选择开始时间"
|
||||
@@ -144,6 +159,10 @@ export default function RecordPage(props: RecordPageProps) {
|
||||
onSizeChange: size => fetchRecords(1, size),
|
||||
}}
|
||||
columns={[
|
||||
{
|
||||
header: '套餐编号',
|
||||
accessorKey: 'resource.resource_no',
|
||||
},
|
||||
{
|
||||
header: '批次号',
|
||||
cell: ({row}) => <div>{row.original.batch_no}</div>,
|
||||
@@ -174,11 +193,6 @@ export default function RecordPage(props: RecordPageProps) {
|
||||
cell: ({row}) => <div>{row.original.count}</div>,
|
||||
accessorKey: 'count',
|
||||
},
|
||||
// {
|
||||
// header: '资源数量',
|
||||
// cell: ({row}) => <div>{row.original.resource_id}</div>,
|
||||
// accessorKey: 'resource_id',
|
||||
// },
|
||||
{
|
||||
header: '提取时间',
|
||||
cell: ({row}) => {
|
||||
|
||||
Reference in New Issue
Block a user