Merge branch 'dev' of http://47.97.1.152:5880/r/wms-master into dev
| | |
| | | companys: 'Companys', |
| | | serialRuleItem: 'SerialRuleItem', |
| | | serialRule: 'SerialRule', |
| | | |
| | | whMat: 'Warehouse Mat', |
| | | }, |
| | | table: { |
| | | field: { |
| | |
| | | batchRole: 'batch role', |
| | | } |
| | | }, |
| | | |
| | | whMat: { |
| | | title: { |
| | | add: 'add', |
| | | } |
| | | }, |
| | | }, |
| | | form: { |
| | | matnr: { |
| | |
| | | companys: '往来企业', |
| | | serialRuleItem: '编码规则子表', |
| | | serialRule: '编码规则', |
| | | |
| | | whMat: '库区物料关系', |
| | | }, |
| | | table: { |
| | | field: { |
| | |
| | | currValue: "当前流水号", |
| | | lastCode: "最近生成编码", |
| | | }, |
| | | |
| | | } |
| | | }, |
| | | page: { |
| | |
| | | control: '控制属性', |
| | | batchRole: '批次规则', |
| | | } |
| | | }, |
| | | whMat: { |
| | | title: { |
| | | add: '添加', |
| | | } |
| | | }, |
| | | }, |
| | | form: { |
| | | matnr: { |
| | | name: '物料名称不能为空', |
| | |
| | | import companys from './basicInfo/companys'; |
| | | import serialRuleItem from './serialRuleItem'; |
| | | import serialRule from './serialRule'; |
| | | import whMat from './basicInfo/whMat'; |
| | | |
| | | |
| | | const ResourceContent = (node) => { |
| | |
| | | return serialRuleItem; |
| | | case 'serialRule': |
| | | return serialRule; |
| | | case 'whMat': |
| | | return whMat; |
| | | default: |
| | | return { |
| | | list: ListGuesser, |
New file |
| | |
| | | import React, { useState, useRef, useEffect, useMemo } from "react"; |
| | | import { Box, Card, CardContent, LinearProgress, TextField, Button, Typography } from "@mui/material"; |
| | | import * as Icons from '@mui/icons-material'; |
| | | import { List, useTranslate, useListContext, Title, } from "react-admin"; |
| | | import WhMatListAside from "./WhMatListAside"; |
| | | import { RichTreeView } from "@mui/x-tree-view/RichTreeView"; |
| | | import { TreeItem2 } from "@mui/x-tree-view/TreeItem2"; |
| | | import request from '@/utils/request'; |
| | | import { Add, Edit, Delete, Padding, Save } from '@mui/icons-material'; |
| | | import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown'; |
| | | import KeyboardArrowRightIcon from '@mui/icons-material/KeyboardArrowRight'; |
| | | import RefreshIcon from '@mui/icons-material/Refresh'; |
| | | import { useTreeItem2Utils } from '@mui/x-tree-view/hooks'; |
| | | import WhMatCreate from "./whMatCreate"; |
| | | |
| | | // const RESOURCE = 'dept'; |
| | | const TITLE = 'menu.whMat'; |
| | | |
| | | const WhMatListContent = () => { |
| | | const translate = useTranslate(); |
| | | const [searchVal, setSearchVal] = useState(''); |
| | | const [createDialog, setCreateDialog] = React.useState(false); |
| | | const [editRecord, setEditRecord] = React.useState(null); |
| | | const treeData = [ |
| | | { |
| | | id: '19', |
| | | label: '半成品', |
| | | secondaryLabel: 'RM001', |
| | | editable: true, |
| | | children: [ |
| | | { |
| | | id: 'grid-community', primaryText: '半成品', |
| | | secondaryText: 'RM001', label: '@mui/x-data-grid', editable: true, children: [ |
| | | { |
| | | id: 'grid-community22', primaryText: '半成品', |
| | | secondaryText: 'RM001', label: '@mui/x-data-grid', editable: true |
| | | },] |
| | | }, |
| | | { |
| | | id: 'grid-pro', primaryText: '半成品', |
| | | secondaryText: 'RM001', label: '@mui/x-data-grid-pro', editable: true |
| | | }, |
| | | { |
| | | id: 'grid-premium', primaryText: '半成品', |
| | | secondaryText: 'RM001', label: '@mui/x-data-grid-premium', editable: true |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | id: '18', |
| | | label: '原材料', |
| | | primaryText: '半成品', |
| | | secondaryText: 'RM001', |
| | | }, |
| | | { |
| | | id: 'charts', |
| | | label: 'Charts', |
| | | primaryText: '半成品', |
| | | secondaryText: 'RM001', |
| | | children: [{ |
| | | id: 'charts-community', primaryText: '半成品', |
| | | secondaryText: 'RM001', label: '@mui/x-charts' |
| | | }], |
| | | }, |
| | | { |
| | | id: 'tree-view', |
| | | label: 'Tree View', |
| | | primaryText: '半成品', |
| | | secondaryLabel: 'RM001', |
| | | children: [{ |
| | | id: 'tree-view-community', primaryText: '半成品', |
| | | secondaryText: 'RM001', label: '@mui/x-tree-view' |
| | | }], |
| | | }, |
| | | { |
| | | id: 'tree-view2', |
| | | label: 'Tree View3', |
| | | primaryText: '半成品', |
| | | secondaryText: 'RM001', |
| | | children: [{ |
| | | id: 'tree-view-community1', primaryText: '半成品', |
| | | secondaryText: 'RM001', label: '@mui/x-tree-view' |
| | | }], |
| | | }, |
| | | ]; |
| | | const handleNodeSelect = (event, nodeId) => { |
| | | console.log('Selected Node ID:', nodeId); |
| | | // 在这里可以根据 nodeId 更新主内容区域 |
| | | }; |
| | | const handleSearch = () => { |
| | | console.log('Search Input:', selectedOption); |
| | | }; |
| | | |
| | | |
| | | const CustomCheckbox = React.forwardRef(function CustomCheckbox(props, ref) { |
| | | return <input type="checkbox" ref={ref} {...props} />; |
| | | }); |
| | | function CustomLabel({ children, className, secondaryLabel }) { |
| | | return ( |
| | | <Box display={"flex"} alignItems={"end"}> |
| | | <Typography fontWeight={500}>{children}</Typography> |
| | | <Box width={10}></Box> |
| | | {secondaryLabel && ( |
| | | <Typography variant="caption" color="secondary"> |
| | | {secondaryLabel} |
| | | </Typography> |
| | | )} |
| | | </Box> |
| | | ); |
| | | } |
| | | const CustomTreeItem = React.forwardRef(function CustomTreeItem(props, ref) { |
| | | const { publicAPI } = useTreeItem2Utils({ |
| | | itemId: props.itemId, |
| | | children: props.children, |
| | | }); |
| | | |
| | | const item = publicAPI.getItem(props.itemId); |
| | | |
| | | return ( |
| | | <TreeItem2 |
| | | {...props} |
| | | ref={ref} |
| | | slots={{ |
| | | label: CustomLabel, |
| | | }} |
| | | slotProps={{ |
| | | label: { secondaryLabel: item?.secondaryLabel || '' }, |
| | | }} |
| | | |
| | | /> |
| | | ); |
| | | }); |
| | | |
| | | const isLoading = false; |
| | | |
| | | React.useEffect(() => { |
| | | request.post('/matnrGroup/tree', {}) |
| | | .then(res => { |
| | | if (res?.data?.code === 200) { |
| | | let data = res.data.data; |
| | | console.log(data); |
| | | |
| | | } else { |
| | | notify(res.data.msg); |
| | | } |
| | | }) |
| | | .catch(error => { |
| | | notify('Error fetching tree data'); |
| | | }); |
| | | }, [searchVal]) |
| | | |
| | | const handleAdd = () => { |
| | | setCreateDialog(true); |
| | | }; |
| | | |
| | | return ( |
| | | <> |
| | | <Box sx={{ mt: 1, mr: 3, display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}> |
| | | <WhMatCreate |
| | | editRecord={editRecord} |
| | | open={createDialog} |
| | | setOpen={setCreateDialog} |
| | | /> |
| | | <Box |
| | | width={300} |
| | | mb={1} |
| | | > |
| | | <TextField |
| | | label={translate('ra.action.search')} |
| | | value={searchVal} |
| | | onChange={(e) => handleInput(e.target.value)} |
| | | /> |
| | | </Box> |
| | | <Box> |
| | | <Button |
| | | variant="outlined" |
| | | color="primary" |
| | | startIcon={<Add />} |
| | | onClick={handleAdd} |
| | | > |
| | | {translate('ra.action.add')} |
| | | </Button> |
| | | <Button |
| | | variant="outlined" |
| | | color="error" |
| | | startIcon={<Delete />} |
| | | sx={{ ml: 1 }} |
| | | > |
| | | {translate('ra.action.delete')} |
| | | </Button> |
| | | <Button |
| | | variant="outlined" |
| | | color="primary" |
| | | sx={{ ml: 1 }} |
| | | startIcon={<Save />} |
| | | > |
| | | {translate('ra.action.save')} |
| | | </Button> |
| | | </Box> |
| | | </Box> |
| | | |
| | | <Card> |
| | | <CardContent> |
| | | <RichTreeView |
| | | defaultExpandedItems={['grid', 'pickers']} |
| | | checkboxSelection |
| | | items={treeData} |
| | | slots={{ item: CustomTreeItem }} |
| | | onItemClick={handleNodeSelect} // 监听节点点击事件 |
| | | /> |
| | | </CardContent> |
| | | </Card> |
| | | </> |
| | | ) |
| | | } |
| | | |
| | | const WhMatList = () => { |
| | | const translate = useTranslate(); |
| | | return ( |
| | | <> |
| | | <Box sx={{ |
| | | display: 'flex', |
| | | marginBottom: 24 |
| | | }}> |
| | | <Title title={TITLE} /> |
| | | <Box> |
| | | <WhMatListAside /> |
| | | </Box> |
| | | <Box sx={{ flexGrow: 1 }}> |
| | | <WhMatListContent /> |
| | | </Box> |
| | | </Box> |
| | | </> |
| | | |
| | | ) |
| | | } |
| | | export default WhMatList; |
New file |
| | |
| | | import React, { useState, useRef, useEffect, useMemo, useCallback } from "react"; |
| | | import { Card, useTheme, List, CardContent, Input, InputAdornment, IconButton, TextField } from "@mui/material"; |
| | | import { useForm } from 'react-hook-form'; |
| | | import Warehouse from "./warehouse"; |
| | | import { Filter, SearchInput, useListContext,useTranslate } from 'react-admin'; |
| | | import request from '@/utils/request'; |
| | | |
| | | const WhMatListAside = () => { |
| | | const theme = useTheme(); |
| | | const translate = useTranslate(); |
| | | const [searchVal, setSearchVal] = useState(''); |
| | | const { control, getValues } = useForm(); |
| | | const [map, setMap] = useState([ |
| | | { |
| | | id: 1, |
| | | name: '仓库1', |
| | | code: 'WH1', |
| | | icon: 'Warehouse', |
| | | locCount: 350, |
| | | }, |
| | | { |
| | | id: 2, |
| | | name: '仓库2', |
| | | code: 'WH1', |
| | | icon: 'Warehouse', |
| | | locCount: 237, |
| | | }, |
| | | { |
| | | id: 3, |
| | | name: '仓库3', |
| | | code: 'WH1', |
| | | icon: 'Warehouse', |
| | | locCount: 590, |
| | | } |
| | | ]); |
| | | |
| | | const handleInput = (value) => { |
| | | console.log(value); |
| | | setSearchVal(value); |
| | | } |
| | | React.useEffect(() => { |
| | | request.post('/matnrGroup/tree', {}) |
| | | .then(res => { |
| | | if (res?.data?.code === 200) { |
| | | let data = res.data.data; |
| | | console.log(data); |
| | | |
| | | } else { |
| | | notify(res.data.msg); |
| | | } |
| | | }) |
| | | .catch(error => { |
| | | notify('Error fetching tree data'); |
| | | }); |
| | | }, [searchVal]) |
| | | |
| | | return ( |
| | | <Card |
| | | sx={{ |
| | | order: -1, |
| | | mr: 2, |
| | | mt: 4, |
| | | width: 250 |
| | | }} |
| | | > |
| | | <CardContent> |
| | | <div> |
| | | <TextField |
| | | label={translate('ra.action.search')} |
| | | value={searchVal} |
| | | onChange={(e) => handleInput(e.target.value)} |
| | | |
| | | /> |
| | | </div> |
| | | <List> |
| | | {map.map(record => ( |
| | | <Warehouse key={record.id} record={record} /> |
| | | ))} |
| | | </List> |
| | | </CardContent> |
| | | |
| | | </Card> |
| | | ) |
| | | } |
| | | |
| | | export default WhMatListAside; |
New file |
| | |
| | | import React, { useState, useRef, useEffect, useMemo } from "react"; |
| | | import { |
| | | ListGuesser, |
| | | EditGuesser, |
| | | ShowGuesser, |
| | | } from "react-admin"; |
| | | |
| | | import WhMatList from "./WhMatList"; |
| | | |
| | | export default { |
| | | list: WhMatList, |
| | | recordRepresentation: (record) => { |
| | | return `${record.name}` |
| | | } |
| | | }; |
New file |
| | |
| | | import React, { useState, useRef, useEffect, useMemo, useCallback } from "react"; |
| | | import { Card, useTheme, List, CardContent, Input, InputAdornment, IconButton, TextField } from "@mui/material"; |
| | | import { useForm } from 'react-hook-form'; |
| | | import Warehouse from "./warehouse"; |
| | | import { Filter, SearchInput } from 'react-admin'; |
| | | |
| | | |
| | | export const MySearchInput = (props) => { |
| | | const [searchTerm, setSearchTerm] = useState(''); |
| | | |
| | | return ( |
| | | <> |
| | | <TextField |
| | | label="Search" |
| | | value={searchTerm} |
| | | onChange={(e) => setSearchTerm(e.target.value)} |
| | | /> |
| | | {/* <Button onClick={handleSearch}>Search</Button> */} |
| | | </> |
| | | ) |
| | | } |
New file |
| | |
| | | import { ListItem, ListItemIcon, ListItemText, ListItemButton, Box, ListItemSecondaryAction } from "@mui/material"; |
| | | import React, { useState, useRef, useEffect, useMemo } from "react"; |
| | | import * as Icons from '@mui/icons-material'; |
| | | |
| | | const Warehouse = (props) => { |
| | | const { record } = props; |
| | | const IconComponent = Icons[record.icon]; |
| | | return ( |
| | | <Box sx={{padding: '5px'}}> |
| | | <ListItem disablePadding> |
| | | <ListItemButton > |
| | | <ListItemIcon sx={{ minWidth: '30px' }}> |
| | | <IconComponent /> |
| | | </ListItemIcon> |
| | | <ListItemText primary={record.name} /> |
| | | <ListItemSecondaryAction> |
| | | <Box |
| | | component="span" |
| | | sx={{ |
| | | marginRight: '1em', |
| | | color: 'text.primary', |
| | | }} |
| | | > |
| | | {record.locCount} |
| | | </Box> |
| | | </ListItemSecondaryAction> |
| | | </ListItemButton> |
| | | </ListItem> |
| | | </Box> |
| | | ) |
| | | } |
| | | |
| | | |
| | | export default Warehouse; |
New file |
| | |
| | | import React, { useState, useRef, useEffect, useMemo } from "react"; |
| | | import { |
| | | CreateBase, |
| | | Form, |
| | | useTranslate, |
| | | Toolbar, |
| | | SaveButton, |
| | | TextInput, |
| | | required, |
| | | NumberInput, |
| | | } from 'react-admin'; |
| | | import { |
| | | Dialog, |
| | | DialogActions, |
| | | DialogContent, |
| | | DialogTitle, |
| | | Stack, |
| | | Grid, |
| | | Box, |
| | | TableRow, |
| | | IconButton, |
| | | Table, |
| | | TableBody, |
| | | TableCell, |
| | | TableContainer, |
| | | TableHead, |
| | | Paper, |
| | | Checkbox |
| | | } 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'; |
| | | |
| | | |
| | | const columns = [ |
| | | { |
| | | id: 'checkbox', |
| | | label: 1, |
| | | align: 'center', |
| | | minWidth: 50, |
| | | }, |
| | | { |
| | | id: 'name', |
| | | label: 'table.field.dept.name', |
| | | minWidth: 170, |
| | | }, |
| | | { |
| | | id: 'fullName', |
| | | label: 'table.field.dept.fullName', |
| | | minWidth: 170, |
| | | }, |
| | | { |
| | | id: 'leader', |
| | | label: 'table.field.dept.leader', |
| | | minWidth: 170, |
| | | }, |
| | | { |
| | | id: 'updateTime', |
| | | label: 'common.field.updateTime', |
| | | minWidth: 170, |
| | | format: (val) => { |
| | | return new Date(val).toLocaleString(); |
| | | } |
| | | }, |
| | | ]; |
| | | |
| | | const WhMatCreate = (props) => { |
| | | const translate = useTranslate(); |
| | | const { editRecord, open, setOpen, callback, resource } = props; |
| | | |
| | | const handleClose = (event, reason) => { |
| | | if (reason !== "backdropClick") { |
| | | setOpen(false); |
| | | } |
| | | }; |
| | | |
| | | const onSubmit = (data) => { |
| | | const _params = { ...data }; |
| | | }; |
| | | |
| | | return ( |
| | | <> |
| | | <CreateBase> |
| | | <Dialog |
| | | open={open} |
| | | onClose={handleClose} |
| | | aria-labelledby="form-dialog-title" |
| | | fullWidth |
| | | disableRestoreFocus |
| | | maxWidth="lg" // 'xs' | 'sm' | 'md' | 'lg' | 'xl' |
| | | > |
| | | <Form record={editRecord} onSubmit={onSubmit}> |
| | | <DialogTitle id="form-dialog-title" sx={{ |
| | | position: 'sticky', |
| | | top: 0, |
| | | backgroundColor: 'background.paper', |
| | | zIndex: 1000 |
| | | }} |
| | | > |
| | | {editRecord ? translate('update.title') : translate('create.title')} |
| | | <Box sx={{ position: 'absolute', top: 8, right: 8, zIndex: 1001 }}> |
| | | <DialogCloseButton onClose={handleClose} /> |
| | | </Box> |
| | | </DialogTitle> |
| | | <DialogContent sx={{ mt: 2 }}> |
| | | <WhMatCreateContent /> |
| | | </DialogContent> |
| | | <DialogActions sx={{ position: 'sticky', bottom: 0, backgroundColor: 'background.paper', zIndex: 1000 }}> |
| | | <Toolbar sx={{ width: '100%', justifyContent: 'space-between' }} > |
| | | <SaveButton /> |
| | | </Toolbar> |
| | | </DialogActions> |
| | | </Form> |
| | | </Dialog> |
| | | </CreateBase> |
| | | </> |
| | | ); |
| | | }; |
| | | const StyledTableRow = styled(TableRow)(({ theme }) => ({ |
| | | '& .MuiButtonBase-root': { |
| | | padding: '0px 8px' |
| | | } |
| | | })); |
| | | |
| | | const StyledTableCell = styled(TableCell)(({ theme }) => ({ |
| | | overflow: 'hidden', |
| | | textOverflow: 'ellipsis', |
| | | whiteSpace: 'nowrap', |
| | | maxWidth: 600, |
| | | })); |
| | | |
| | | const TreeTableRow = (props) => { |
| | | const { row, depth = 0, openNodes, setOpenNodes, onEdit, onDelete } = props; |
| | | const isOpen = openNodes[row.id] || false; |
| | | const [checked, setChecked] = useState(false); |
| | | const toggleNode = (id) => { |
| | | setOpenNodes(prevState => ({ ...prevState, [id]: !prevState[id] })); |
| | | }; |
| | | return ( |
| | | <React.Fragment> |
| | | <StyledTableRow hover tabIndex={-1} key={row.id}> |
| | | <StyledTableCell sx={{ padding: 0, width: 60 }}> |
| | | {row.children && ( |
| | | <IconButton |
| | | aria-label="expand row" |
| | | size="small" |
| | | style={{ paddingLeft: (depth * 16) }} |
| | | onClick={() => toggleNode(row.id)} |
| | | > |
| | | {isOpen ? <KeyboardArrowDownIcon /> : <KeyboardArrowRightIcon />} |
| | | </IconButton> |
| | | )} |
| | | </StyledTableCell> |
| | | <StyledTableCell key="checkbox" align="center" style={{ paddingLeft: (depth * 16 + 16) }}> |
| | | <Checkbox |
| | | checked={row.checked} |
| | | onChange={() => {row.checked = !row.checked;}} |
| | | /> |
| | | </StyledTableCell> |
| | | {columns.map((column, idx) => { |
| | | if (column.id !== 'actions' && column.id !== 'checkbox') { |
| | | const value = row[column.id]; |
| | | return ( |
| | | <> |
| | | <StyledTableCell |
| | | key={column.id} |
| | | align={column.align || 'left'} |
| | | style={{ paddingLeft: idx === 0 && (depth * 16 + 16) }} |
| | | onClick={() => toggleNode(row.id)} |
| | | > |
| | | {column.format ? column.format(value) : value} |
| | | </StyledTableCell> |
| | | </> |
| | | |
| | | ) |
| | | } |
| | | })} |
| | | {/* <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) => ( |
| | | <TreeTableRow |
| | | key={child.id} |
| | | row={child} |
| | | depth={depth + 1} |
| | | openNodes={openNodes} |
| | | setOpenNodes={setOpenNodes} |
| | | /> |
| | | )) |
| | | )} |
| | | </React.Fragment> |
| | | ); |
| | | }; |
| | | |
| | | const WhMatCreateContent = (props) => { |
| | | const translate = useTranslate(); |
| | | const [treeData, setTreeData] = useState([ |
| | | { |
| | | id: 1, name: 'root', fullName: '根节点', leader: '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: 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: 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 }, |
| | | |
| | | |
| | | ]); |
| | | const [openNodes, setOpenNodes] = React.useState({}); |
| | | |
| | | return ( |
| | | <> |
| | | <Grid container rowSpacing={2} columnSpacing={2}> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.dept.name" |
| | | source="name" |
| | | parse={v => v} |
| | | validate={required()} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.dept.fullName" |
| | | source="fullName" |
| | | parse={v => v} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.dept.leader" |
| | | source="leader" |
| | | parse={v => v} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="table.field.dept.sort" |
| | | source="sort" |
| | | /> |
| | | </Grid> |
| | | |
| | | </Grid> |
| | | <TableContainer component={Paper}> |
| | | <Table size="small"> |
| | | <TableHead> |
| | | <TableRow> |
| | | <StyledTableCell sx={{ padding: 0, width: 60 }} /> |
| | | {columns.map((column, idx) => ( |
| | | <StyledTableCell |
| | | key={idx} |
| | | align={column.align || 'left'} |
| | | style={{ |
| | | minWidth: column.minWidth |
| | | }} |
| | | > |
| | | {typeof column.label === 'string' ? translate(column.label) : <Checkbox />} |
| | | </StyledTableCell> |
| | | ))} |
| | | </TableRow> |
| | | </TableHead> |
| | | <TableBody> |
| | | {treeData && treeData.length > 0 && ( |
| | | treeData.map((row) => ( |
| | | <TreeTableRow |
| | | key={row.id} |
| | | row={row} |
| | | openNodes={openNodes} |
| | | setOpenNodes={setOpenNodes} |
| | | /> |
| | | )) |
| | | )} |
| | | </TableBody> |
| | | </Table> |
| | | </TableContainer> |
| | | </> |
| | | |
| | | ); |
| | | }; |
| | | |
| | | export default WhMatCreate; |
| | |
| | | omit={['id', 'createTime', 'createBy', 'memo']} |
| | | > |
| | | <NumberField source="id" /> |
| | | <NumberField source="warehouseId$" label="table.field.loc.warehouseId" />, |
| | | <NumberField source="warehouseId$" label="table.field.loc.warehouseId" /> |
| | | <NumberField source="areaId$" label="table.field.loc.areaId" /> |
| | | <TextField source="code" label="table.field.loc.code" /> |
| | | <TextField source="type" label="table.field.loc.type" /> |