解决我的账单页面报错 & 提交记录添加套餐号筛选

This commit is contained in:
Eamon-meng
2026-05-18 15:52:35 +08:00
parent fde097c601
commit 5c236c0b01
8 changed files with 218 additions and 187 deletions

View File

@@ -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}) => {