skyouc
2 天以前 ca36e3b92acaa53f042fd8af1920930af782efc6
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
import * as React from 'react';
import { useTranslate, useReference } from 'react-admin';
import {
    ListItem,
    ListItemSecondaryAction,
    ListItemAvatar,
    ListItemText,
    Typography,
    Avatar,
    Box,
    ListItemButton,
    Card,
    CardHeader,
    List,
    Grid,
} from '@mui/material';
import { Link } from 'react-router-dom';
 
const NbList = ({ deadStock }) => {
    const translate = useTranslate();
    return (
        <Card sx={{
            flex: 1,
            boxShadow: 2,
            maxWidth: 598,
            marginTop: 1
        }}>
            <CardHeader 
                title={translate('page.dashboard.list.stock')}
                sx={{ 
                    pb: 1,
                    '& .MuiCardHeader-title': {
                        fontSize: '1.1rem',
                        fontWeight: 600,
                    }
                }} 
            />
            <Box sx={{ maxHeight: 500, overflowY: 'auto' }}>
                <List dense={true} sx={{ py: 0 }}>
                    {deadStock.map(record => (
                        <PendingOrder 
                            key={`${record?.id}_${Math.random().toString(36).substr(2, 9)}`} 
                            order={record} 
                        />
                    ))}
                </List>
            </Box>
        </Card>
    );
};
 
export const PendingOrder = (props) => {
    const { order } = props;
    const translate = useTranslate();
 
    return (
        <ListItem 
            disablePadding
            sx={{
                borderBottom: '1px solid',
                borderColor: 'divider',
                '&:last-child': {
                    borderBottom: 'none',
                }
            }}
        >
            <ListItemButton 
                sx={{
                    py: 1.5,
                    '&:hover': {
                        backgroundColor: 'action.hover',
                    }
                }}
            >
                <Grid container spacing={1}>
                    {/* 第一行:物料编码和名称 */}
                    <Grid item xs={12} sx={{ display: 'flex', alignItems: 'center' }}>
                        <Box sx={{ display: 'flex', alignItems: 'center', minWidth: 0, flex: 1 }}>
                            <Typography 
                                variant="body2" 
                                sx={{ 
                                    fontWeight: 600,
                                    color: 'primary.main',
                                    minWidth: '120px',
                                    flexShrink: 0,
                                }}
                            >
                                {translate("table.field.asnOrderItem.matnrCode")}:
                            </Typography>
                            <Typography 
                                variant="body2" 
                                sx={{ 
                                    color: 'text.primary',
                                    overflow: 'hidden',
                                    textOverflow: 'ellipsis',
                                    whiteSpace: 'nowrap',
                                }}
                            >
                                {order?.matnrCode}
                            </Typography>
                        </Box>
                        
                        <Box sx={{ display: 'flex', alignItems: 'center', minWidth: 0, flex: 1 }}>
                            <Typography 
                                variant="body2" 
                                sx={{ 
                                    fontWeight: 600,
                                    color: 'primary.main',
                                    minWidth: '80px',
                                    flexShrink: 0,
                                }}
                            >
                                {translate("table.field.asnOrderItem.maktx")}:
                            </Typography>
                            <Typography 
                                variant="body2" 
                                sx={{ 
                                    color: 'text.primary',
                                    overflow: 'hidden',
                                    textOverflow: 'ellipsis',
                                    whiteSpace: 'nowrap',
                                }}
                                title={order?.maktx} // 添加title提示完整内容
                            >
                                {order?.maktx}
                            </Typography>
                        </Box>
                    </Grid>
 
                    {/* 第二行:数量和日期 */}
                    <Grid item xs={12} sx={{ display: 'flex', alignItems: 'center' }}>
                        <Box sx={{ display: 'flex', alignItems: 'center', minWidth: 0, flex: 1 }}>
                            <Typography 
                                variant="body2" 
                                sx={{ 
                                    fontWeight: 600,
                                    color: 'primary.main',
                                    minWidth: '120px',
                                    flexShrink: 0,
                                }}
                            >
                                {translate("table.field.asnOrderItem.anfme")}:
                            </Typography>
                            <Typography 
                                variant="body2" 
                                sx={{ 
                                    color: 'text.primary',
                                    fontWeight: 500,
                                }}
                            >
                                {order?.anfme}
                            </Typography>
                        </Box>
                        
                        <Box sx={{ display: 'flex', alignItems: 'center', minWidth: 0, flex: 1 }}>
                            <Typography 
                                variant="body2" 
                                sx={{ 
                                    fontWeight: 600,
                                    color: 'primary.main',
                                    minWidth: '120px',
                                    flexShrink: 0,
                                }}
                            >
                                {translate("table.field.locItem.deadTime")}:
                            </Typography>
                            <Typography 
                                variant="body2" 
                                sx={{ 
                                    color: order?.deadTime ? 'error.main' : 'text.secondary',
                                    fontWeight: order?.deadTime ? 600 : 400,
                                    fontFamily: 'monospace',
                                }}
                            >
                                {order?.deadTime || '-'}
                            </Typography>
                        </Box>
                    </Grid>
                </Grid>
            </ListItemButton>
        </ListItem>
    );
};
 
export default NbList;