|
|
@@ -5,13 +5,17 @@ import Filter from './filter';
|
|
|
import {useBoolean} from 'ahooks';
|
|
|
import Item from './item';
|
|
|
import {Refresh} from '@components';
|
|
|
-import {useField} from './hooks';
|
|
|
-import {useInfiniteFetch} from '@hooks';
|
|
|
+import {useField, useClearException, useEditDate} from './hooks';
|
|
|
+import {useInfiniteFetch, useParams} from '@hooks';
|
|
|
import {getList} from '@apis';
|
|
|
|
|
|
export default function List() {
|
|
|
+ const {type} = useParams();
|
|
|
+
|
|
|
const [visible, {setFalse: onClose, setTrue: onShow}] = useBoolean();
|
|
|
- const [fields, {onChange, reset}] = useField();
|
|
|
+
|
|
|
+ const [fields, {onChange, reset}] = useField(type);
|
|
|
+
|
|
|
const [
|
|
|
{data, isFetching, isFetchingNextPage, hasNextPage, isEmpty},
|
|
|
{fetchNextPage, refresh},
|
|
|
@@ -20,16 +24,17 @@ export default function List() {
|
|
|
fn: getList,
|
|
|
limit: 5,
|
|
|
params: {
|
|
|
- agoScrq: fields.startTime,
|
|
|
- endScrq: fields.endTime,
|
|
|
- agoFinalTime: fields.startTime2,
|
|
|
- endFinalTime: fields.endTime2,
|
|
|
- customer: fields.custom,
|
|
|
+ states: fields?.state ?? false ? '0' : '',
|
|
|
+ anomaly: type,
|
|
|
+ arrivalTime: fields.date,
|
|
|
truckNo: fields.track,
|
|
|
- anomaly: fields.anomaly ? '1' : '',
|
|
|
+ customer: fields.custom,
|
|
|
},
|
|
|
});
|
|
|
|
|
|
+ const onClear = useClearException(refresh);
|
|
|
+ const onEdit = useEditDate();
|
|
|
+
|
|
|
return (
|
|
|
<>
|
|
|
<Refresh
|
|
|
@@ -44,7 +49,15 @@ export default function List() {
|
|
|
>
|
|
|
<View className='h-3' />
|
|
|
{(data?.pages ?? []).map(function (val) {
|
|
|
- return <Item key={val.id} {...val} />;
|
|
|
+ return (
|
|
|
+ <Item
|
|
|
+ key={val.id}
|
|
|
+ {...val}
|
|
|
+ type={type}
|
|
|
+ onClear={onClear(val.id, val.truckNo, val.customer)}
|
|
|
+ onEdit={onEdit(val.id)}
|
|
|
+ />
|
|
|
+ );
|
|
|
})}
|
|
|
<View className='h-3' />
|
|
|
</Refresh>
|