Merge branch 'front' into devlop
| | |
| | | name: "name", |
| | | code: "code", |
| | | parentId: "parentId", |
| | | parCode: "parCode", |
| | | }, |
| | | warehouse: { |
| | | name: "name", |
| | |
| | | subzone: 'subzone', |
| | | bindmatnr: 'bind matnr', |
| | | bindloc: 'bind loc', |
| | | batchMatnrGropu: 'batchMatnrGropu', |
| | | }, |
| | | }; |
| | | |
| | |
| | | name: "名称", |
| | | code: "编码", |
| | | parentId: "上级标识", |
| | | parCode: "上级编码", |
| | | }, |
| | | warehouse: { |
| | | name: "仓库名称", |
| | |
| | | subzone: '绑定分区', |
| | | bindmatnr: '绑定物料', |
| | | bindloc: '绑定库位', |
| | | batchMatnrGropu: '批量物料分组', |
| | | }, |
| | | }; |
| | | |
| | |
| | | <RALayout |
| | | appBar={AppBar} |
| | | menu={MyMenu} |
| | | sx={{ '& .RaLayout-content': { position: 'absolute', left: '200px', overflowY: 'auto', width: 'calc(100% - 200px)', height: 'calc(100% - 50px)' } }} |
| | | > |
| | | {children} |
| | | <CheckForApplicationUpdate /> |
| | |
| | | typeId: selectedItems |
| | | } |
| | | |
| | | const res = await request.post(`/locAreaMatRela/locType/remove/`, parmas); |
| | | const res = await request.post(`/locAreaMatRela/locType/remove`, parmas); |
| | | if (res?.data?.code === 200) { |
| | | reload() |
| | | notify(res.data.msg); |
New file |
| | |
| | | import React, { useState, useRef, useEffect, useMemo } from "react"; |
| | | import { |
| | | CreateBase, |
| | | useTranslate, |
| | | TextInput, |
| | | NumberInput, |
| | | BooleanInput, |
| | | DateInput, |
| | | SaveButton, |
| | | SelectInput, |
| | | ReferenceInput, |
| | | ReferenceArrayInput, |
| | | AutocompleteInput, |
| | | Toolbar, |
| | | required, |
| | | useDataProvider, |
| | | useNotify, |
| | | Form, |
| | | useCreateController, |
| | | useListContext, |
| | | useRefresh, |
| | | } from 'react-admin'; |
| | | import { |
| | | Dialog, |
| | | DialogActions, |
| | | DialogContent, |
| | | DialogTitle, |
| | | Grid, |
| | | TextField, |
| | | Box, |
| | | Button, |
| | | Paper, |
| | | TableContainer, |
| | | Table, |
| | | TableHead, |
| | | TableBody, |
| | | TableRow, |
| | | TableCell, |
| | | Tooltip, |
| | | IconButton, |
| | | styled |
| | | |
| | | |
| | | } from '@mui/material'; |
| | | import DialogCloseButton from "../../components/DialogCloseButton"; |
| | | import DictionarySelect from "../../components/DictionarySelect"; |
| | | import { useForm, Controller, useWatch, FormProvider, useFormContext } from "react-hook-form"; |
| | | import SaveIcon from '@mui/icons-material/Save'; |
| | | import request from '@/utils/request'; |
| | | import { Add, Edit, Delete } from '@mui/icons-material'; |
| | | import _ from 'lodash'; |
| | | import { DataGrid } from '@mui/x-data-grid'; |
| | | import StatusSelectInput from "../../components/StatusSelectInput"; |
| | | import TreeSelectInput from "@/page/components/TreeSelectInput"; |
| | | |
| | | const InitModal = ({ open, setOpen }) => { |
| | | const refresh = useRefresh(); |
| | | const translate = useTranslate(); |
| | | |
| | | |
| | | const notify = useNotify(); |
| | | |
| | | const [formData, setFormData] = useState({ |
| | | 'groupId': null |
| | | }); |
| | | |
| | | const { selectedIds, onUnselectItems } = useListContext(); |
| | | |
| | | const handleClose = (event, reason) => { |
| | | if (reason !== "backdropClick") { |
| | | setOpen(false); |
| | | reset() |
| | | refresh(); |
| | | onUnselectItems() |
| | | } |
| | | }; |
| | | |
| | | const reset = () => { |
| | | setFormData({ |
| | | 'groupId': null |
| | | }) |
| | | } |
| | | |
| | | const handleReset = (e) => { |
| | | e.preventDefault(); |
| | | }; |
| | | |
| | | const handleChange = (value, name) => { |
| | | setFormData((prevData) => ({ |
| | | ...prevData, |
| | | [name]: ['locType', 'type'].includes(name) ? value : +value |
| | | })); |
| | | }; |
| | | |
| | | const removeEmptyKeys = (obj) => { |
| | | return _.pickBy(obj, (value) => { |
| | | if (_.isObject(value)) { |
| | | const newObj = removeEmptyKeys(value); |
| | | return !_.isEmpty(newObj); |
| | | } |
| | | return !_.isNil(value) && (_.isNumber(value) ? value !== 0 : !_.isEmpty(value)); |
| | | }); |
| | | } |
| | | |
| | | const handleSubmit = async () => { |
| | | const parmas = { |
| | | ids: selectedIds, |
| | | ...removeEmptyKeys(formData) |
| | | } |
| | | |
| | | const res = await request.post(`/matnr/group/bind`, parmas); |
| | | if (res?.data?.code === 200) { |
| | | handleClose() |
| | | |
| | | } else { |
| | | notify(res.data.msg); |
| | | } |
| | | } |
| | | |
| | | return ( |
| | | <Dialog open={open} maxWidth="md" fullWidth> |
| | | <Form onSubmit={handleSubmit}> |
| | | <DialogCloseButton onClose={handleClose} /> |
| | | <DialogTitle>{translate('toolbar.batchMatnrGropu')}</DialogTitle> |
| | | <DialogContent sx={{ mt: 2 }}> |
| | | <Box sx={{ display: 'flex', flexDirection: 'column', gap: 3 }}> |
| | | <Grid container spacing={2}> |
| | | <Grid item xs={4}> |
| | | <TreeSelectInput |
| | | label="table.field.locAreaMatRela.groupId" |
| | | resource={'matnrGroup'} |
| | | source="groupId" |
| | | value={formData.groupId} |
| | | onChange={(e) => handleChange(+e.target.value, 'groupId')} |
| | | /> |
| | | </Grid> |
| | | </Grid> |
| | | |
| | | </Box> |
| | | </DialogContent> |
| | | <DialogActions sx={{ position: 'sticky', bottom: 0, backgroundColor: 'background.paper', zIndex: 1000 }}> |
| | | <Box sx={{ width: '100%', display: 'flex', justifyContent: 'space-between' }}> |
| | | <Button type="submit" variant="contained" startIcon={<SaveIcon />}> |
| | | {translate('toolbar.confirm')} |
| | | </Button> |
| | | </Box> |
| | | </DialogActions> |
| | | </Form> |
| | | </Dialog> |
| | | ); |
| | | } |
| | | |
| | | export default InitModal; |
| | |
| | | redirect="list" |
| | | mutationMode={EDIT_MODE} |
| | | actions={<CustomerTopToolBar />} |
| | | aside={<EditBaseAside />} |
| | | title={"menu.matnr"} |
| | | > |
| | | <SimpleForm |
| | |
| | | import PrintIcon from '@mui/icons-material/Print'; |
| | | import request from '@/utils/request'; |
| | | import BatchModal from './BatchModal'; |
| | | import BatchGropuModal from './BatchGropuModal'; |
| | | import PrintModal from './PrintModal'; |
| | | import LinkIcon from '@mui/icons-material/Link'; |
| | | import BindModal from './BindModal'; |
| | |
| | | overflow: 'hidden', |
| | | textOverflow: 'ellipsis', |
| | | display: 'block', |
| | | width: '300px', |
| | | width: '200px', |
| | | }, |
| | | '& .RaDatagrid-table': { |
| | | width: '100%' |
| | | width: '100%', |
| | | position: 'relative', |
| | | } |
| | | })); |
| | | |
| | |
| | | <TextField key="memo" source="memo" label="common.field.memo" sortable={false} />, |
| | | ] |
| | | const fields = data.map(el => <TextField key={el.fields} source={`extendFields.[${el.fields}]`} label={el.fieldsAlise} />) |
| | | const opt = <WrapperField key="opt" cellClassName="opt" label="common.field.opt"> |
| | | const opt = <WrapperField key="opt" cellClassName="fixed" className="fixed" label="common.field.opt"> |
| | | <EditButton sx={{ padding: '1px', fontSize: '.75rem' }} /> |
| | | <EnableButton /> |
| | | </WrapperField> |
| | |
| | | <StyledDatagrid |
| | | preferenceKey='matnr' |
| | | bulkActionButtons={<> |
| | | <BatchGroupButton /> |
| | | <BatchButton /> |
| | | <BindButton /> |
| | | <PrintButton /> |
| | |
| | | ) |
| | | } |
| | | |
| | | const BatchGroupButton = () => { |
| | | const record = useRecordContext(); |
| | | const notify = useNotify(); |
| | | const refresh = useRefresh(); |
| | | |
| | | |
| | | const [createDialog, setCreateDialog] = useState(false); |
| | | |
| | | return ( |
| | | <> |
| | | <Button onClick={() => setCreateDialog(true)} label={"toolbar.batchMatnrGropu"}> |
| | | <EditIcon /> |
| | | </Button> |
| | | |
| | | <BatchGropuModal |
| | | open={createDialog} |
| | | setOpen={setCreateDialog} |
| | | /> |
| | | </> |
| | | |
| | | ) |
| | | } |
| | | |
| | | const PrintButton = () => { |
| | | const record = useRecordContext(); |
| | | const { resource, selectedIds } = useListContext(); |
| | |
| | | rows={selectedIds} |
| | | /> |
| | | </> |
| | | |
| | | ) |
| | | } |
| | | |
| | |
| | | validate={required()} |
| | | /> |
| | | </Grid> |
| | | {/* <Grid item xs={6} display="flex" gap={1}> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.matnrGroup.code" |
| | | source="code" |
| | | parse={v => v} |
| | | validate={required()} |
| | | /> |
| | | </Grid> */} |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="table.field.matnrGroup.parentId" |
| | |
| | | Stack, |
| | | Grid, |
| | | Box, |
| | | TextField |
| | | } from '@mui/material'; |
| | | import DialogCloseButton from "@/page/components/DialogCloseButton"; |
| | | import TreeSelectInput from "@/page/components/TreeSelectInput"; |
| | | import { useWatch, useFormContext } from "react-hook-form"; |
| | | import { useWatch, useFormContext, useFieldArray } from "react-hook-form"; |
| | | import * as Common from '@/utils/common'; |
| | | import { EDIT_MODE, REFERENCE_INPUT_PAGESIZE } from '@/config/setting'; |
| | | import EditBaseAside from "@/page/components/EditBaseAside"; |
| | | import CustomerTopToolBar from "@/page/components/EditTopToolBar"; |
| | | import MemoInput from "@/page/components/MemoInput"; |
| | | import StatusSelectInput from "@/page/components/StatusSelectInput"; |
| | | |
| | | import request from '@/utils/request'; |
| | | |
| | | const EditContent = ({ editRecord }) => { |
| | | const { resource } = useCreateContext(); |
| | | const translate = useTranslate(); |
| | | |
| | | const { update } = useFieldArray({ name: "parCode" }) |
| | | |
| | | const pChange = (val) => { |
| | | if (val > 0) { |
| | | http(val) |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | const http = async (val) => { |
| | | const res = await request.post(`/matnrGroup/page`, { id: val }); |
| | | const code = res.data.data.records[0].code || '' |
| | | // setpCode(code) |
| | | editRecord.parCode = code; |
| | | update(code) |
| | | } |
| | | return ( |
| | | <Grid container rowSpacing={2} columnSpacing={2}> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <TreeSelectInput |
| | | label="table.field.matnrGroup.parentId" |
| | | validate={[required()]} |
| | | value={editRecord?.parentId} |
| | | isTranslate |
| | | resource={resource} |
| | | onChange={(e) => pChange(e.target.value)} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.matnrGroup.parCode" |
| | | validate={[required()]} |
| | | source="parCode" |
| | | value={editRecord?.parCode} |
| | | parse={v => v} |
| | | disabled |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | |
| | | validate={required()} |
| | | /> |
| | | </Grid> |
| | | {/* <Grid item xs={6} display="flex" gap={1}> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.matnrGroup.code" |
| | | source="code" |
| | | parse={v => v} |
| | | disabled={!!editRecord} |
| | | /> |
| | | </Grid> */} |
| | | </Grid> |
| | | </Grid> |
| | | ) |
| | | } |
| | |
| | | import * as Common from '@/utils/common'; |
| | | import { useFormContext } from 'react-hook-form'; |
| | | |
| | | const TreeSelectInput = ({ resource, label, source = 'parentId', value, isTranslate = false, ...rest }) => { |
| | | const TreeSelectInput = ({ resource, onChange, label, source = 'parentId', value, isTranslate = false, ...rest }) => { |
| | | const translate = useTranslate(); |
| | | const { setValue } = useFormContext(); |
| | | const [filter, setFilter] = React.useState(""); |
| | |
| | | shouldValidate: true, |
| | | shouldDirty: true, |
| | | }); |
| | | onChange(event) |
| | | }; |
| | | |
| | | return ( |
| | |
| | | import { |
| | | useTranslate, |
| | | useNotify, |
| | | TextInput |
| | | } from 'react-admin'; |
| | | import { Box, Button, Card, Stack, CardContent, Skeleton } from '@mui/material'; |
| | | import { SimpleTreeView, TreeItem, RichTreeView, useTreeViewApiRef } from '@mui/x-tree-view'; |
| | |
| | | }) |
| | | } |
| | | const http = async () => { |
| | | const res = await request.post('/menu' + '/tree', {}); |
| | | const res = await request.post('/menu' + '/tree', { condition: '' }); |
| | | if (res?.data?.code === 200) { |
| | | const transformData = transformTree(res.data.data); |
| | | setTreeData(transformData); |
| | |
| | | </Button> |
| | | </Box> |
| | | <Box sx={{ |
| | | display: 'flex', |
| | | justifyContent: 'flex-start' |
| | | }}> |
| | | |
| | | <Button startIcon={<SaveIcon />} variant="contained" onClick={handleSave}> |
| | | {translate('ra.action.save')} |
| | | </Button> |
| | | </Box> |
| | | |
| | | <Box sx={{ |
| | | height: 480, |
| | | minWidth: 290, |
| | | overflow: 'auto', |
| | | marginTop: '10px', |
| | | padding: 1, |
| | | borderBottom: '1px solid background.paper', |
| | | borderRadius: '4px', |
| | |
| | | |
| | | </Box> |
| | | </Box> |
| | | <Box sx={{ |
| | | display: 'flex', |
| | | justifyContent: 'flex-start' |
| | | }}> |
| | | <Button startIcon={<SaveIcon />} variant="contained" onClick={handleSave}> |
| | | {translate('ra.action.save')} |
| | | </Button> |
| | | </Box> |
| | | |
| | | </CardContent> |
| | | </Card> |
| | | </> |