Merge branch 'dev' of http://47.97.1.152:5880/r/wms-master into dev
| | |
| | | currValue: "currValue", |
| | | lastCode: "lastCode", |
| | | }, |
| | | whMat: { |
| | | matnrCode: "matnrCode", |
| | | matnrName: "matnrName", |
| | | matnrGroupId: "matnrGroupId", |
| | | spec: "spec", |
| | | color: "color", |
| | | size: "size", |
| | | minWeight: "minWeight", |
| | | maxWeight: "maxWeight", |
| | | } |
| | | } |
| | | }, |
| | | page: { |
| | |
| | | import { code, s } from "motion/react-client"; |
| | | import chineseMessages from "./core/chineseMessages"; |
| | | |
| | | const customChineseMessages = { |
| | |
| | | currValue: "当前流水号", |
| | | lastCode: "最近生成编码", |
| | | }, |
| | | |
| | | whMat: { |
| | | matnrCode: "物料编码", |
| | | matnrName: "物料名称", |
| | | matnrGroupId: "物料分组", |
| | | spec: "规格", |
| | | color: "颜色", |
| | | size: "尺寸", |
| | | minWeight: "最小重量", |
| | | maxWeight: "最大重量", |
| | | } |
| | | } |
| | | }, |
| | | page: { |
| | |
| | | Toolbar, |
| | | SaveButton, |
| | | TextInput, |
| | | ReferenceInput, |
| | | AutocompleteInput, |
| | | required, |
| | | NumberInput, |
| | | } from 'react-admin'; |
| | |
| | | TableContainer, |
| | | TableHead, |
| | | Paper, |
| | | Checkbox |
| | | Checkbox, |
| | | Button |
| | | } from '@mui/material'; |
| | | import DialogCloseButton from "@/page/components/DialogCloseButton"; |
| | | import { styled } from '@mui/material/styles'; |
| | | import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown'; |
| | | import KeyboardArrowRightIcon from '@mui/icons-material/KeyboardArrowRight'; |
| | | import { Search } from "@mui/icons-material"; |
| | | import { tr } from "date-fns/locale"; |
| | | |
| | | |
| | | const columns = [ |
| | | { |
| | | id: 'checkbox', |
| | | label: 1, |
| | | align: 'center', |
| | | minWidth: 50, |
| | | id: 'matnrCode', |
| | | label: 'table.field.whMat.matnrCode', |
| | | minWidth: 160, |
| | | }, |
| | | { |
| | | id: 'name', |
| | | label: 'table.field.dept.name', |
| | | minWidth: 170, |
| | | id: 'matnrName', |
| | | label: 'table.field.whMat.matnrName', |
| | | }, |
| | | { |
| | | id: 'fullName', |
| | | label: 'table.field.dept.fullName', |
| | | minWidth: 170, |
| | | id: 'matnrGroupId', |
| | | label: 'table.field.whMat.matnrGroupId', |
| | | }, |
| | | { |
| | | id: 'leader', |
| | | label: 'table.field.dept.leader', |
| | | minWidth: 170, |
| | | id: 'spec', |
| | | label: 'table.field.whMat.spec', |
| | | }, |
| | | { |
| | | id: 'updateTime', |
| | | label: 'common.field.updateTime', |
| | | minWidth: 170, |
| | | format: (val) => { |
| | | return new Date(val).toLocaleString(); |
| | | } |
| | | id: 'color', |
| | | label: 'table.field.whMat.color', |
| | | }, |
| | | { |
| | | id: 'size', |
| | | label: 'table.field.whMat.size', |
| | | }, |
| | | { |
| | | id: 'minWeight', |
| | | label: 'table.field.whMat.minWeight', |
| | | }, |
| | | { |
| | | id: 'maxWeight', |
| | | label: 'table.field.whMat.maxWeight', |
| | | }, |
| | | ]; |
| | | |
| | |
| | | }; |
| | | const StyledTableRow = styled(TableRow)(({ theme }) => ({ |
| | | '& .MuiButtonBase-root': { |
| | | padding: '0px 8px' |
| | | padding: '0px 0px' |
| | | } |
| | | })); |
| | | |
| | | const StyledTableCell = styled(TableCell)(({ theme }) => ({ |
| | | '& .MuiButtonBase-root': { |
| | | padding: '0px 0px' |
| | | }, |
| | | overflow: 'hidden', |
| | | textOverflow: 'ellipsis', |
| | | whiteSpace: 'nowrap', |
| | |
| | | return ( |
| | | <React.Fragment> |
| | | <StyledTableRow hover tabIndex={-1} key={row.id}> |
| | | <StyledTableCell sx={{ padding: 0, width: 60 }}> |
| | | <StyledTableCell sx={{ padding: 0, width: 20 }}> |
| | | {row.children && ( |
| | | <IconButton |
| | | aria-label="expand row" |
| | | size="small" |
| | | style={{ paddingLeft: (depth * 16) }} |
| | | style={{ marginLeft: (depth * 16 + 8) }} |
| | | onClick={() => toggleNode(row.id)} |
| | | > |
| | | {isOpen ? <KeyboardArrowDownIcon /> : <KeyboardArrowRightIcon />} |
| | | </IconButton> |
| | | )} |
| | | </StyledTableCell> |
| | | <StyledTableCell key="checkbox" align="center" style={{ paddingLeft: (depth * 16 + 16) }}> |
| | | <StyledTableCell style={{ paddingLeft: (depth * 16 + 16) }}> |
| | | <Checkbox |
| | | key={row.id} |
| | | checked={row.checked} |
| | | onChange={() => {row.checked = !row.checked;}} |
| | | // onChange={() => { row.checked = !row.checked; }} |
| | | /> |
| | | </StyledTableCell> |
| | | {columns.map((column, idx) => { |
| | | if (column.id !== 'actions' && column.id !== 'checkbox') { |
| | | if (column.id !== 'actions') { |
| | | const value = row[column.id]; |
| | | return ( |
| | | <> |
| | | <StyledTableCell |
| | | key={column.id} |
| | | align={column.align || 'left'} |
| | | style={{ paddingLeft: idx === 0 && (depth * 16 + 16) }} |
| | | // style={{ paddingLeft: idx === 0 && (depth * 16 + 16) }} |
| | | onClick={() => toggleNode(row.id)} |
| | | > |
| | | {column.format ? column.format(value) : value} |
| | |
| | | ) |
| | | } |
| | | })} |
| | | {/* <StyledTableCell> |
| | | <Tooltip title="Edit"> |
| | | <IconButton onClick={() => onEdit(row)}> |
| | | <Edit /> |
| | | </IconButton> |
| | | </Tooltip> |
| | | <Tooltip title="Delete"> |
| | | <IconButton onClick={() => onDelete(row)}> |
| | | <Delete /> |
| | | </IconButton> |
| | | </Tooltip> |
| | | </StyledTableCell> */} |
| | | </StyledTableRow> |
| | | {row.children && isOpen && ( |
| | | row.children.map((child) => ( |
| | |
| | | |
| | | const WhMatCreateContent = (props) => { |
| | | const translate = useTranslate(); |
| | | const [selAll, setSelAll] = useState(false); |
| | | const [treeData, setTreeData] = useState([ |
| | | { |
| | | id: 1, name: 'root', fullName: '根节点', leader: 'admin', sort: 1, checked: false, children: [ |
| | | id: 1, matnrCode: 'root1', matnrName: '根节点', matnrGroupId: 'admin', sort: 1, checked: false, children: [ |
| | | { |
| | | id: 29, name: 'root', fullName: '根节点', leader: 'admin', sort: 1, children: [ |
| | | { id: 30, name: 'root', fullName: '根节点', leader: 'admin', sort: 1, children: null }, |
| | | { id: 31, name: 'root', fullName: '根节点', leader: 'admin', sort: 1, children: null }, |
| | | { id: 32, name: 'root', fullName: '根节点', leader: 'admin', sort: 1, children: null }, |
| | | { id: 33, name: 'root', fullName: '根节点', leader: 'admin', sort: 1, children: null }, |
| | | { id: 34, name: 'root', fullName: '根节点', leader: 'admin', sort: 1, children: null }, |
| | | { id: 35, name: 'root', fullName: '根节点', leader: 'admin', sort: 1, children: null }, |
| | | id: 29, matnrCode: 'root29', fullName: '根节点', leader: 'admin', sort: 1, checked: false, children: [ |
| | | { id: 30, matnrCode: 'root30', fullName: '根节点', leader: 'admin', sort: 1, checked: false, children: null }, |
| | | { id: 31, matnrCode: 'root31', fullName: '根节点', leader: 'admin', sort: 1, checked: false, children: null }, |
| | | { id: 32, matnrCode: 'root32', fullName: '根节点', leader: 'admin', sort: 1, checked: false, children: null }, |
| | | { id: 33, matnrCode: 'root33', fullName: '根节点', leader: 'admin', sort: 1, checked: false, children: null }, |
| | | { id: 34, matnrCode: 'root34', fullName: '根节点', leader: 'admin', sort: 1, checked: false, children: null }, |
| | | { id: 35, matnrCode: 'root35', fullName: '根节点', leader: 'admin', sort: 1, checked: false, children: null }, |
| | | ] |
| | | }, |
| | | { id: 24, name: 'root', fullName: '根节点', leader: 'admin', sort: 1, children: null }, |
| | | { id: 25, name: 'root', fullName: '根节点', leader: 'admin', sort: 1, children: null }, |
| | | { id: 26, name: 'root', fullName: '根节点', leader: 'admin', sort: 1, children: null }, |
| | | { id: 27, name: 'root', fullName: '根节点', leader: 'admin', sort: 1, children: null }, |
| | | { id: 28, name: 'root', fullName: '根节点', leader: 'admin', sort: 1, children: null }, |
| | | { id: 24, matnrCode: 'root24', fullName: '根节点', leader: 'admin', sort: 1, checked: false, children: null }, |
| | | { id: 25, matnrCode: 'root25', fullName: '根节点', leader: 'admin', sort: 1, checked: false, children: null }, |
| | | { id: 26, matnrCode: 'root26', fullName: '根节点', leader: 'admin', sort: 1, checked: false, children: null }, |
| | | { id: 27, matnrCode: 'root27', fullName: '根节点', leader: 'admin', sort: 1, checked: false, children: null }, |
| | | { id: 28, matnrCode: 'root28', fullName: '根节点', leader: 'admin', sort: 1, checked: false, children: null }, |
| | | |
| | | ] |
| | | }, |
| | | { id: 2, name: 'root', fullName: '根节点', leader: 'admin', sort: 1, children: null }, |
| | | { id: 3, name: 'root', fullName: '根节点', leader: 'admin', sort: 1, children: null }, |
| | | { id: 4, name: 'root', fullName: '根节点', leader: 'admin', sort: 1, children: null }, |
| | | { id: 5, name: 'root', fullName: '根节点', leader: 'admin', sort: 1, children: null }, |
| | | { id: 6, name: 'root', fullName: '根节点', leader: 'admin', sort: 1, children: null }, |
| | | { id: 7, name: 'root', fullName: '根节点', leader: 'admin', sort: 1, children: null }, |
| | | { id: 8, name: 'root', fullName: '根节点', leader: 'admin', sort: 1, children: null }, |
| | | { id: 9, name: 'root', fullName: '根节点', leader: 'admin', sort: 1, children: null }, |
| | | { id: 10, name: 'root', fullName: '根节点', leader: 'admin', sort: 1, children: null }, |
| | | { id: 11, name: 'root', fullName: '根节点', leader: 'admin', sort: 1, children: null }, |
| | | { id: 12, name: 'root', fullName: '根节点', leader: 'admin', sort: 1, children: null }, |
| | | { id: 13, name: 'root', fullName: '根节点', leader: 'admin', sort: 1, children: null }, |
| | | { id: 14, name: 'root', fullName: '根节点', leader: 'admin', sort: 1, children: null }, |
| | | { id: 15, name: 'root', fullName: '根节点', leader: 'admin', sort: 1, children: null }, |
| | | { id: 16, name: 'root', fullName: '根节点', leader: 'admin', sort: 1, children: null }, |
| | | { id: 17, name: 'root', fullName: '根节点', leader: 'admin', sort: 1, children: null }, |
| | | { id: 18, name: 'root', fullName: '根节点', leader: 'admin', sort: 1, children: null }, |
| | | { id: 19, name: 'root', fullName: '根节点', leader: 'admin', sort: 1, children: null }, |
| | | { id: 20, name: 'root', fullName: '根节点', leader: 'admin', sort: 1, children: null }, |
| | | { id: 21, name: 'root', fullName: '根节点', leader: 'admin', sort: 1, children: null }, |
| | | { id: 22, name: 'root', fullName: '根节点', leader: 'admin', sort: 1, children: null }, |
| | | { id: 23, name: 'root', fullName: '根节点', leader: 'admin', sort: 1, children: null }, |
| | | { id: 2, matnrCode: 'root2', fullName: '根节点', leader: 'admin', sort: 1, checked: false, children: null }, |
| | | { id: 3, matnrCode: 'root3', fullName: '根节点', leader: 'admin', sort: 1, checked: false, children: null }, |
| | | { id: 4, matnrCode: 'root4', fullName: '根节点', leader: 'admin', sort: 1, checked: false, children: null }, |
| | | { id: 5, matnrCode: 'root5', fullName: '根节点', leader: 'admin', sort: 1, checked: false, children: null }, |
| | | { id: 6, matnrCode: 'root6', fullName: '根节点', leader: 'admin', sort: 1, checked: false, children: null }, |
| | | { id: 7, matnrCode: 'root', fullName: '根节点', leader: 'admin', sort: 1, checked: false, children: null }, |
| | | { id: 8, matnrCode: 'root', fullName: '根节点', leader: 'admin', sort: 1, checked: false, children: null }, |
| | | { id: 9, matnrCode: 'root', fullName: '根节点', leader: 'admin', sort: 1, checked: false, children: null }, |
| | | { id: 10, matnrCode: 'root', fullName: '根节点', leader: 'admin', sort: 1, checked: false, children: null }, |
| | | { id: 11, matnrCode: 'root', fullName: '根节点', leader: 'admin', sort: 1, checked: false, children: null }, |
| | | { id: 12, matnrCode: 'root', fullName: '根节点', leader: 'admin', sort: 1, checked: false, children: null }, |
| | | { id: 13, matnrCode: 'root', fullName: '根节点', leader: 'admin', sort: 1, checked: false, children: null }, |
| | | { id: 14, matnrCode: 'root', fullName: '根节点', leader: 'admin', sort: 1, checked: false, children: null }, |
| | | { id: 15, matnrCode: 'root', fullName: '根节点', leader: 'admin', sort: 1, checked: false, children: null }, |
| | | { id: 16, matnrCode: 'root', fullName: '根节点', leader: 'admin', sort: 1, checked: false, children: null }, |
| | | { id: 17, matnrCode: 'root', fullName: '根节点', leader: 'admin', sort: 1, checked: false, children: null }, |
| | | { id: 18, matnrCode: 'root', fullName: '根节点', leader: 'admin', sort: 1, checked: false, children: null }, |
| | | { id: 19, matnrCode: 'root', fullName: '根节点', leader: 'admin', sort: 1, checked: false, children: null }, |
| | | { id: 20, matnrCode: 'root', fullName: '根节点', leader: 'admin', sort: 1, checked: false, children: null }, |
| | | { id: 21, matnrCode: 'root', fullName: '根节点', leader: 'admin', sort: 1, checked: false, children: null }, |
| | | { id: 22, matnrCode: 'root', fullName: '根节点', leader: 'admin', sort: 1, checked: false, children: null }, |
| | | { id: 23, matnrCode: 'root', fullName: '根节点', leader: 'admin', sort: 1, checked: false, children: null }, |
| | | |
| | | |
| | | ]); |
| | | const [openNodes, setOpenNodes] = React.useState({}); |
| | | |
| | | const handleSearch = () => { |
| | | console.log('handleSearch'); |
| | | } |
| | | const selectAll = () => { |
| | | selAll ? setSelAll(false) : setSelAll(true); |
| | | } |
| | | |
| | | useEffect(() => { |
| | | console.log(selAll); |
| | | |
| | | const setAllChecked = (nodes, checked) => { |
| | | nodes.forEach(node => { |
| | | node.checked = !checked; |
| | | if (node.children) { |
| | | setAllChecked(node.children, checked); |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | if (selAll) { |
| | | setAllChecked(treeData, true); |
| | | } else { |
| | | setAllChecked(treeData, false); |
| | | } |
| | | }, [selAll]); |
| | | |
| | | return ( |
| | | <> |
| | | <Grid container rowSpacing={2} columnSpacing={2}> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <Grid item xs={3} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.dept.name" |
| | | source="name" |
| | | parse={v => v} |
| | | validate={required()} |
| | | label="table.field.whMat.matnrCode" |
| | | source="matnrCode" |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <Grid item xs={3} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.dept.fullName" |
| | | source="fullName" |
| | | parse={v => v} |
| | | label="table.field.whMat.matnrName" |
| | | source="matnrName" |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.dept.leader" |
| | | source="leader" |
| | | parse={v => v} |
| | | <Grid item xs={3} display="flex" gap={1}> |
| | | <ReferenceInput |
| | | source="groupId" |
| | | reference="matnrGroup" |
| | | > |
| | | <AutocompleteInput |
| | | label="table.field.whMat.matnrGroupId" |
| | | optionText="name" |
| | | filterToQuery={(val) => ({ name: val })} |
| | | /> |
| | | </ReferenceInput> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="table.field.dept.sort" |
| | | source="sort" |
| | | <Grid item xs={3} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.whMat.spec" |
| | | source="spec" |
| | | /> |
| | | </Grid> |
| | | |
| | | <Grid item xs={3} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.whMat.color" |
| | | source="color" |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={3} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.whMat.size" |
| | | source="size" |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={3} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.whMat.minWeight" |
| | | source="minWeight" |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={3} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.whMat.maxWeight" |
| | | source="maxWeight" |
| | | /> |
| | | </Grid> |
| | | </Grid> |
| | | <Box sx={{ mt: 2, mb: 2 }}> |
| | | <Stack direction="row" spacing={1} justifyContent="flex-end"> |
| | | <Button |
| | | variant="outlined" |
| | | color="primary" |
| | | startIcon={<Search />} |
| | | onClick={handleSearch} |
| | | > |
| | | {translate('ra.action.search')} |
| | | </Button> |
| | | </Stack> |
| | | </Box> |
| | | <TableContainer component={Paper}> |
| | | <Table size="small"> |
| | | <TableHead> |
| | | <TableRow> |
| | | <StyledTableCell sx={{ padding: 0, width: 60 }} /> |
| | | <StyledTableCell sx={{ padding: 0, width: 0 }} /> |
| | | <StyledTableCell sx={{ width: 0 }} > |
| | | <Checkbox checked={selAll} onClick={selectAll} /> |
| | | </StyledTableCell> |
| | | {columns.map((column, idx) => ( |
| | | <StyledTableCell |
| | | key={idx} |
| | | align={column.align || 'left'} |
| | | style={{ |
| | | minWidth: column.minWidth |
| | | minWidth: column.minWidth, |
| | | }} |
| | | > |
| | | {typeof column.label === 'string' ? translate(column.label) : <Checkbox />} |
| | | {translate(column.label)} |
| | | </StyledTableCell> |
| | | ))} |
| | | </TableRow> |