import React, { useState } from "react";
|
import {
|
List,
|
DatagridConfigurable,
|
SearchInput,
|
TopToolbar,
|
SelectColumnsButton,
|
ShowButton,
|
FilterButton,
|
WrapperField,
|
TextField,
|
NumberField,
|
DateField,
|
BooleanField,
|
TextInput,
|
DateInput,
|
NumberInput,
|
ReferenceInput,
|
AutocompleteInput,
|
} from 'react-admin';
|
import { PAGE_DRAWER_WIDTH, DEFAULT_PAGE_SIZE } from '@/config/setting';
|
import DictionarySelect from "../../components/DictionarySelect";
|
import { Box } from '@mui/material';
|
import PageDrawer from "../../components/PageDrawer";
|
import AsnOrderLogCreate from "./AsnOrderLogCreate";
|
import { styled } from '@mui/material/styles';
|
|
const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({
|
'& .css-1vooibu-MuiSvgIcon-root': { height: '.9em' },
|
'& .RaDatagrid-row': { cursor: 'auto' },
|
'& .opt': { width: 150 },
|
'& .MuiTableCell-root': { whiteSpace: 'nowrap', overflow: 'visible', textOverflow: 'unset' }
|
}));
|
|
/**
|
* 入库历史单:typeFilter="in", listTitle="menu.asnOrderLog"
|
* 出库历史单:typeFilter="out", listTitle="menu.outStockOrderLog"
|
*/
|
export default function AsnOrderLogListBase({ typeFilter, listTitle }) {
|
const [createDialog, setCreateDialog] = useState(false);
|
const [drawerVal, setDrawerVal] = useState(false);
|
|
const filters = [
|
<SearchInput source="condition" alwaysOn />,
|
<TextInput source="code" label="table.field.asnOrderLog.code" />,
|
<TextInput source="poCode" label="table.field.asnOrderLog.poCode" />,
|
<NumberInput source="poId" label="table.field.asnOrderLog.poId" />,
|
<NumberInput source="anfme" label="table.field.asnOrderLog.anfme" />,
|
<NumberInput source="qty" label="table.field.asnOrderLog.qty" />,
|
<TextInput source="logisNo" label="table.field.asnOrderLog.logisNo" />,
|
<DateInput source="arrTime" label="table.field.asnOrderLog.arrTime" />,
|
<ReferenceInput source="wkType" reference="dictData" filter={{ dictTypeCode: 'sys_business_type', group: "1" }} label="table.field.asnOrder.wkType" alwaysOn>
|
<AutocompleteInput label="table.field.asnOrder.wkType" optionValue="value" />
|
</ReferenceInput>,
|
<DictionarySelect
|
label='table.field.asnOrder.exceStatus'
|
name="exceStatus"
|
group="1"
|
dictTypeCode="sys_asn_exce_status"
|
alwaysOn
|
/>,
|
];
|
|
return (
|
<Box display="flex">
|
<List
|
key={`orderLog-list-${typeFilter}`}
|
sx={{
|
flexGrow: 1,
|
transition: (theme) => theme.transitions.create(['all'], { duration: theme.transitions.duration.enteringScreen }),
|
marginRight: drawerVal ? `${PAGE_DRAWER_WIDTH}px` : 0,
|
}}
|
title={listTitle}
|
empty={false}
|
filters={filters}
|
filterDefaultValues={{ type: typeFilter }}
|
filter={{ type: typeFilter }}
|
sort={{ field: "create_time", order: "desc" }}
|
actions={(
|
<TopToolbar>
|
<FilterButton />
|
<SelectColumnsButton preferenceKey='asnOrderLog' />
|
</TopToolbar>
|
)}
|
perPage={DEFAULT_PAGE_SIZE}
|
>
|
<StyledDatagrid
|
preferenceKey='asnOrderLog'
|
bulkActionButtons={false}
|
rowClick={false}
|
expand={false}
|
expandSingle={true}
|
omit={['id', 'createTime', 'createBy', 'memo', 'logisNo', 'poId', 'rleStatus$', 'statusBool', 'createBy$']}
|
>
|
<NumberField source="id" />
|
<TextField source="code" label="table.field.asnOrderLog.code" />
|
<TextField source="poCode" label="table.field.asnOrderLog.poCode" />
|
<NumberField source="poId" label="table.field.asnOrderLog.poId" />
|
<TextField source="type$" label="table.field.asnOrderLog.type" />
|
<TextField source="wkType$" label="table.field.asnOrderLog.wkType" />
|
<NumberField source="anfme" label="table.field.asnOrderLog.anfme" options={{ minimumFractionDigits: 2, maximumFractionDigits: 2 }} />
|
<NumberField source="qty" label="table.field.asnOrderLog.qty" options={{ minimumFractionDigits: 2, maximumFractionDigits: 2 }} />
|
<TextField source="logisNo" label="table.field.asnOrderLog.logisNo" />
|
<DateField source="arrTime" label="table.field.asnOrderLog.arrTime" showTime />
|
<TextField source="rleStatus$" label="table.field.asnOrderLog.rleStatus" sortable={false} />
|
<TextField source="updateBy$" label="common.field.updateBy" />
|
<DateField source="updateTime" label="common.field.updateTime" showTime />
|
<TextField source="createBy$" label="common.field.createBy" />
|
<DateField source="createTime" label="common.field.createTime" showTime />
|
<BooleanField source="statusBool" label="common.field.status" sortable={false} />
|
<TextField source="memo" label="common.field.memo" sortable={false} />
|
<WrapperField cellClassName="opt" label="common.field.opt">
|
<ShowButton label="toolbar.detail" />
|
</WrapperField>
|
</StyledDatagrid>
|
</List>
|
<AsnOrderLogCreate open={createDialog} setOpen={setCreateDialog} />
|
<PageDrawer title='AsnOrderLog Detail' drawerVal={drawerVal} setDrawerVal={setDrawerVal} />
|
</Box>
|
);
|
}
|