skyouc
2025-04-08 d458679502e679ff49446e2a69c9d4abbb5ecfd8
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
import React, { useState, useRef, useEffect, useMemo } from "react";
import { Box } from '@mui/material';
import {
    List,
    DatagridConfigurable,
    useRecordContext,
    useTranslate,
    TextField,
    NumberField,
    DateField,
    BooleanField,
    ReferenceField,
} from 'react-admin';
import { styled } from '@mui/material/styles';
import PageDrawer from "../components/PageDrawer";
import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE } from '@/config/setting';
import * as Common from '@/utils/common';
 
const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({
    '& .css-1vooibu-MuiSvgIcon-root': {
        height: '.9em'
    },
    '& .RaDatagrid-row': {
        cursor: 'auto'
    },
    '& .column-name': {
    },
    '& .opt': {
        width: 200
    },
}));
 
const TaskPanel = () => {
    const record = useRecordContext();
    const translate = useTranslate();
    const [createDialog, setCreateDialog] = useState(false);
    const [drawerVal, setDrawerVal] = useState(false);
    return (
        <>
            <Box display="flex">
                <List resource="taskItem"
                    sx={{
                        flexGrow: 1,
                        transition: (theme) =>
                            theme.transitions.create(['all'], {
                                duration: theme.transitions.duration.enteringScreen,
                            }),
                        marginRight: !!drawerVal ? `${PAGE_DRAWER_WIDTH}px` : 0,
                    }}
                    filter={{ taskId: record.id }}
                    title={"menu.taskItem"}
                    pagination={false}
                    empty={false}
                    actions={false}
                >
                    <StyledDatagrid
                        preferenceKey='taskItem'
                        bulkActionButtons={false}
                        rowClick={false}
                        expandSingle
                        omit={['id', 'createTime', 'createBy', 'memo', 'taskId', 'orderId', 'orderItemId', 'matnrId']}
                    >
                        <NumberField source="id" />
                        <NumberField source="taskId" label="table.field.taskItem.taskId" />
                        <NumberField source="orderId" label="table.field.taskItem.orderId" />
                        <NumberField source="orderType$" label="table.field.taskItem.orderType" />
                        <NumberField source="orderItemId" label="table.field.taskItem.orderItemId" />
                        <NumberField source="matnrId" label="table.field.taskItem.matnrId" />
                        <TextField source="maktx" label="table.field.taskItem.maktx" />
                        <TextField source="matnrCode" label="table.field.taskItem.matnrCode" />
                        <TextField source="unit" label="table.field.taskItem.unit" />
                        <NumberField source="anfme" label="table.field.taskItem.anfme" />
                        <TextField source="batch" label="table.field.taskItem.batch" />
                        <TextField source="spec" label="table.field.taskItem.spec" />
                        <TextField source="model" label="table.field.taskItem.model" />
                        <TextField source="updateBy$" label="common.field.updateBy"/>
                        <TextField source="createBy$" label="common.field.createBy"/>
                        <DateField source="updateTime" label="common.field.updateTime" showTime />
                        <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} />
                    </StyledDatagrid>
                </List>
            </Box>
        </>
    );
};
 
export default TaskPanel;