chen.lin
2 天以前 9140aee230de0ef41de9682a9353fbd372e2bcaa
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
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' }
}));
 
/**
 * 入库/出库历史单列表共用骨架,仅 type 与标题由外部传入。
 * 入库历史单:typeFilter="in", listTitle="menu.asnOrderLog"
 * 出库历史单:typeFilter="out", listTitle="menu.outStockOrderLog"
 * 后端接口均为 asnOrderLog(出库由 dataProvider 映射),参数 filter.type 不同。
 */
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" />
                    <NumberField source="qty" label="table.field.asnOrderLog.qty" />
                    <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>
    );
}