| | |
| | | Select, |
| | | MenuItem |
| | | } from '@mui/material'; |
| | | import { useForm, Controller, useWatch, FormProvider, useFormContext } from "react-hook-form"; |
| | | import DialogCloseButton from "../../components/DialogCloseButton"; |
| | | import StatusSelectInput from "../../components/StatusSelectInput"; |
| | | import ConfirmButton from "../../components/ConfirmButton"; |
| | | import MatnrInfoModal from "./MatnrInfoModal"; |
| | | 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 _, { set } from 'lodash'; |
| | | import { DataGrid, useGridApiRef } from '@mui/x-data-grid'; |
| | | import DictionarySelect from "../../components/DictionarySelect"; |
| | | import { DataGrid, useGridApiRef } from '@mui/x-data-grid'; |
| | | import ConfirmButton from "../../components/ConfirmButton"; |
| | | import { Add, Edit, Delete } from '@mui/icons-material'; |
| | | import DictSelect from "../../components/DictSelect"; |
| | | import SaveIcon from '@mui/icons-material/Save'; |
| | | import MatnrInfoModal from "./MatnrInfoModal"; |
| | | import request from '@/utils/request'; |
| | | import _, { set } from 'lodash'; |
| | | import "./asnOrder.css"; |
| | | |
| | | const SelectMatnrModal = (props) => { |
| | |
| | | DateInput, |
| | | ReferenceInput, |
| | | AutocompleteInput, |
| | | SelectColumnsButton, |
| | | DatagridConfigurable, |
| | | Toolbar, |
| | | required, |
| | | useNotify, |
| | | DeleteButton, |
| | | BooleanField, |
| | | EditButton, |
| | | WrapperField, |
| | | SaveButton, |
| | | SimpleForm, |
| | | NumberField, |
| | | useRefresh, |
| | | TextField, |
| | | DateField, |
| | | CreateBase, |
| | | TopToolbar, |
| | | FilterButton, |
| | | SearchInput, |
| | | List, |
| | | Create, |
| | | } from 'react-admin'; |
| | | import { |
| | | Dialog, |
| | | DialogActions, |
| | | DialogContent, |
| | | DialogTitle, |
| | | TextField, |
| | | IconButton, |
| | | MenuItem, |
| | | Tooltip, |
| | |
| | | Button, |
| | | Stack, |
| | | Grid, |
| | | Card, |
| | | Box, |
| | | CardContent, |
| | | } from '@mui/material'; |
| | | import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE } from '@/config/setting'; |
| | | import ConfirmationNumberIcon from '@mui/icons-material/ConfirmationNumber'; |
| | | import DialogCloseButton from "../../components/DialogCloseButton.jsx"; |
| | | import WarehouseSelect from "../../components/WarehouseSelect.jsx"; |
| | |
| | | import { DataGrid, useGridApiRef } from '@mui/x-data-grid'; |
| | | import ConfirmButton from "../../components/ConfirmButton"; |
| | | import { Add, Edit, Delete } from '@mui/icons-material'; |
| | | import SelectLocsRevise from "./SelectLocsRevise.jsx"; |
| | | import DictSelect from "../../components/DictSelect"; |
| | | import SaveIcon from '@mui/icons-material/Save'; |
| | | import { styled } from '@mui/material/styles'; |
| | | import { redirect } from "react-router"; |
| | | import request from '@/utils/request'; |
| | | import _, { set } from 'lodash'; |
| | | |
| | | const StyledSimpleForm = styled(SimpleForm)(({ theme }) => ({ |
| | | '& .MuiToolbar-root-RaToolbar-root': { |
| | | '& .RaToolbar-defaultToolbar': { |
| | | justifyContent: 'flex-end', |
| | | } |
| | | } |
| | | |
| | | })); |
| | | |
| | | |
| | | const LocReviseCreate = (props) => { |
| | | const { open, setOpen, orderId } = props; |
| | |
| | | const translate = useTranslate(); |
| | | const [tabelData, setTableData] = useState([]); |
| | | const [disabled, setDisabled] = useState(false); |
| | | const [isVisible, setIsVisible] = useState("block"); |
| | | const [selectedRows, setSelectedRows] = useState([]); |
| | | const [createDialog, setCreateDialog] = useState(false); |
| | | const [formData, setFormData] = useState({ type: '0', orgAreaId: null, tarAreaId: null, exceTime: null, code: null }); |
| | |
| | | setTableData([...tabelData]); |
| | | } |
| | | |
| | | const handleSubmit = async () => { |
| | | setFinally() |
| | | setDisabled(true) |
| | | const FormToolbar = () => { |
| | | return ( |
| | | <Toolbar sx={{ justifyContent: 'flex-end' }}> |
| | | <SaveButton disabled={disabled} /> |
| | | <DeleteButton mutationMode="optimistic" /> |
| | | </Toolbar> |
| | | ) |
| | | } |
| | | // const handleSubmit = async () => { |
| | | // setFinally() |
| | | // setDisabled(true) |
| | | |
| | | if (orderId == null || orderId == undefined) { |
| | | const parmas = { |
| | | "revise": formData, |
| | | "items": tabelData, |
| | | } |
| | | // if (orderId == null || orderId == undefined) { |
| | | // const parmas = { |
| | | // "revise": formData, |
| | | // "items": tabelData, |
| | | // } |
| | | |
| | | const res = await request.post(`/transfer/items/save`, parmas); |
| | | if (res?.data?.code === 200) { |
| | | setOpen(false); |
| | | } else { |
| | | notify(res.data.msg); |
| | | } |
| | | } else { |
| | | const parmas = { |
| | | "transfer": formData, |
| | | "items": tabelData, |
| | | } |
| | | const res = await request.post(`/transfer/items/update`, parmas); |
| | | if (res?.data?.code === 200) { |
| | | setOpen(false); |
| | | } else { |
| | | notify(res.data.msg); |
| | | } |
| | | } |
| | | setDisabled(false) |
| | | refresh(); |
| | | // const res = await request.post(`/transfer/items/save`, parmas); |
| | | // if (res?.data?.code === 200) { |
| | | // setOpen(false); |
| | | // } else { |
| | | // notify(res.data.msg); |
| | | // } |
| | | // } else { |
| | | // const parmas = { |
| | | // "transfer": formData, |
| | | // "items": tabelData, |
| | | // } |
| | | // const res = await request.post(`/transfer/items/update`, parmas); |
| | | // if (res?.data?.code === 200) { |
| | | // setOpen(false); |
| | | // } else { |
| | | // notify(res.data.msg); |
| | | // } |
| | | // } |
| | | // setDisabled(false) |
| | | // refresh(); |
| | | |
| | | }; |
| | | // }; |
| | | |
| | | const handleDeleteItem = () => { |
| | | const newTableData = _.filter(tabelData, (item) => !selectedRows.includes(item.matnrId)); |
| | |
| | | } |
| | | |
| | | const newAddClick = () => { |
| | | if (formData.areaId == null || formData.areaId == undefined) { |
| | | notify("库区不能为空!!", { type: 'error' }) |
| | | return |
| | | } |
| | | setCreateDialog(true) |
| | | } |
| | | |
| | | const mutationOptions = { |
| | | onSuccess: (data) => { |
| | | notify(`文章 "${data.title}" 创建成功`, { type: 'success' }); |
| | | setIsVisible("block") |
| | | setDisabled(true) |
| | | refresh() |
| | | }, |
| | | onError: (error) => { |
| | | notify(`创建失败: ${error.message}`, { type: 'error' }); |
| | | } |
| | | }; |
| | | |
| | | const handleChange = (value, name) => { |
| | |
| | | return ( |
| | | <> |
| | | <Box sx={{ padding: 1 }}> |
| | | <CreateBase resource="locRevise" mutationOptions={mutationOptions} > |
| | | <SimpleForm > |
| | | <Create resource="locRevise" |
| | | title={false} |
| | | mutationOptions={mutationOptions} > |
| | | <SimpleForm toolbar={<FormToolbar />}> |
| | | <Grid container spacing={2} sx={{ |
| | | '& .MuiToolbar-root-RaToolbar-root.RaToolbar-defaultToolbar': { |
| | | justifyContent: 'flex-end', |
| | | } |
| | | }}> |
| | | <Grid item md={2}> |
| | | <TextInput |
| | | source="code" |
| | | label={translate("table.field.locRevise.code")} |
| | | readOnly |
| | | /> |
| | | </Grid> |
| | | <Grid item md={2}> |
| | | <AutocompleteInput |
| | | choices={dicts} |
| | |
| | | optionValue="value" |
| | | defaultValue="1" |
| | | source="type" |
| | | parse={v => v} |
| | | label={translate("table.field.transfer.type")} |
| | | /> |
| | | </Grid> |
| | |
| | | <AutocompleteInput |
| | | optionText='name' |
| | | optionValue="id" |
| | | parse={v => v} |
| | | label={translate("table.field.locRevise.areaName")} |
| | | /> |
| | | </ReferenceInput> |
| | |
| | | <Grid item md={2}> |
| | | <DateInput |
| | | source="exceTime" |
| | | parse={v => v} |
| | | label="table.field.locRevise.exceTime" |
| | | /> |
| | | </Grid> |
| | | </Grid> |
| | | </SimpleForm> |
| | | </CreateBase> |
| | | </Create> |
| | | <Box sx={{ display: isVisible }}> |
| | | <Card sx={{ height: 630 }}> |
| | | <Box> |
| | | <Box sx={{ mt: 2 }}> |
| | | <Stack direction="row" spacing={2} sx={{ justifyContent: "flex-end" }}> |
| | | <Stack direction="row" spacing={2} sx={{ justifyContent: "flex-start" }}> |
| | | <Button variant="contained" onClick={newAddClick} > |
| | | {translate('common.action.newAddMats')} |
| | | </Button> |
| | |
| | | tableRef={tableRef}> |
| | | </TransferTableView> |
| | | </Box> |
| | | <Toolbar sx={{ width: '100%', justifyContent: 'flex-start', bgcolor: 'white' }} > |
| | | <Button disabled={disabled} onClick={handleSubmit} variant="contained" startIcon={<SaveIcon />}> |
| | | {translate('toolbar.confirm')} |
| | | </Button> |
| | | </Toolbar> |
| | | {/* <CreateBySelectMats |
| | | </Box> |
| | | </Card> |
| | | </Box> |
| | | <SelectLocsRevise |
| | | data={tabelData} |
| | | queryForm={formData} |
| | | open={createDialog} |
| | |
| | | selectedRows={selectedRows} |
| | | setSelectedRows={setSelectedRows} |
| | | setData={setTableData} |
| | | /> */} |
| | | /> |
| | | </Box> |
| | | </> |
| | | ) |
| | |
| | | rowSelectionModel={tableIds} |
| | | onRowSelectionModelChange={handleSelectionChange} |
| | | sx={{ |
| | | height: 580, |
| | | height: 500, |
| | | '& .MuiDataGrid-cell input': { |
| | | border: '1px solid #ccc' |
| | | }, |
| | |
| | | import MemoInput from "@/page/components/MemoInput"; |
| | | import StatusSelectInput from "@/page/components/StatusSelectInput"; |
| | | |
| | | const FormToolbar = () => { |
| | | const { getValues } = useFormContext(); |
| | | |
| | | return ( |
| | | <Toolbar sx={{ justifyContent: 'space-between' }}> |
| | | <SaveButton /> |
| | | <DeleteButton mutationMode="optimistic" /> |
| | | </Toolbar> |
| | | ) |
| | | } |
| | | |
| | | const LocReviseEdit = () => { |
| | | const translate = useTranslate(); |
| | |
| | | <SimpleForm |
| | | shouldUnregister |
| | | warnWhenUnsavedChanges |
| | | toolbar={<FormToolbar />} |
| | | toolbar={false} |
| | | mode="onTouched" |
| | | defaultValues={{}} |
| | | sx={{ |
| | | "& .MuiFormLabel-root.MuiInputLabel-root.Mui-disabled": { |
| | | bgcolor: 'white', |
| | | WebkitTextFillColor: "rgba(0, 0, 0)" |
| | | }, |
| | | |
| | | "& .MuiInputBase-input.MuiFilledInput-input.Mui-disabled": { |
| | | bgcolor: 'white', |
| | | WebkitTextFillColor: "rgba(0, 0, 0)" |
| | | } |
| | | }} |
| | | // validate={(values) => { }} |
| | | > |
| | | <Grid container width={{ xs: '100%', xl: '80%' }} rowSpacing={3} columnSpacing={3}> |
| | | <Grid item xs={12} md={8}> |
| | | <Grid item xs={24} md={12}> |
| | | <Typography variant="h6" gutterBottom> |
| | | {translate('common.edit.title.main')} |
| | | </Typography> |
| | |
| | | label="table.field.locRevise.code" |
| | | source="code" |
| | | parse={v => v} |
| | | autoFocus |
| | | readOnly |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <SelectInput |
| | | label="table.field.locRevise.type" |
| | | source="type" |
| | |
| | | { id: 0, name: ' 库存调整' }, |
| | | { id: 2, name: ' 盘点调整' }, |
| | | ]} |
| | | readOnly |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <NumberInput |
| | | label="table.field.locRevise.anfme" |
| | | source="anfme" |
| | | readOnly |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <NumberInput |
| | | label="table.field.locRevise.reviseQty" |
| | | source="reviseQty" |
| | | readOnly |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <SelectInput |
| | | label="table.field.locRevise.exceStatus" |
| | | source="exceStatus" |
| | |
| | | { id: 1, name: '执行中' }, |
| | | { id: 2, name: '执行完成' }, |
| | | ]} |
| | | readOnly |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <NumberInput |
| | | label="table.field.locRevise.orgAreaId" |
| | | source="orgAreaId" |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <TextInput |
| | | label="table.field.locRevise.orgAreaName" |
| | | label="table.field.locRevise.areaName" |
| | | source="orgAreaName" |
| | | parse={v => v} |
| | | readOnly |
| | | /> |
| | | </Stack> |
| | | |
| | | </Grid> |
| | | <Grid item xs={12} md={4}> |
| | | <Typography variant="h6" gutterBottom> |
| | | {translate('common.edit.title.common')} |
| | | </Typography> |
| | | <StatusSelectInput /> |
| | | <Box mt="2em" /> |
| | | <MemoInput /> |
| | | </Grid> |
| | | </Grid> |
| | | </SimpleForm> |
| | |
| | | rowClick={(id, resource, record) => false} |
| | | expand={false} |
| | | expandSingle={true} |
| | | omit={['id', 'createTime', 'createBy', 'memo']} |
| | | omit={['id', 'createTime', 'createBy', 'orgAreaId', 'memo']} |
| | | > |
| | | <NumberField source="id" /> |
| | | <TextField source="code" label="table.field.locRevise.code" /> |
| | |
| | | <NumberField source="anfme" label="table.field.locRevise.anfme" /> |
| | | <NumberField source="reviseQty" label="table.field.locRevise.reviseQty" /> |
| | | <TextField source="exceStatus$" label="table.field.locRevise.exceStatus" sortable={false} /> |
| | | <NumberField source="orgAreaId" label="table.field.locRevise.orgAreaId" /> |
| | | <TextField source="orgAreaName" label="table.field.locRevise.orgAreaName" /> |
| | | <NumberField source="orgAreaId" label="table.field.locRevise.areaId" /> |
| | | <TextField source="orgAreaName" label="table.field.locRevise.areaName" /> |
| | | <TextField source="updateBy$" label="common.field.updateBy" /> |
| | | <DateField source="updateTime" label="common.field.updateTime" showTime /> |
| | | <DateField source="createBy$" label="common.field.createBy" /> |
New file |
| | |
| | | import React, { useState, useEffect } from "react"; |
| | | import { |
| | | Dialog, |
| | | DialogActions, |
| | | DialogContent, |
| | | DialogTitle, |
| | | Stack, |
| | | Grid, |
| | | Box, |
| | | Button, |
| | | Paper, |
| | | styled, |
| | | Tooltip, |
| | | IconButton, |
| | | TextField, |
| | | } from '@mui/material'; |
| | | |
| | | import { EDIT_MODE, DEFAULT_START_PAGE, DEFAULT_ITEM_PAGE_SIZE, DEFAULT_PAGE_SIZE, REFERENCE_INPUT_PAGESIZE } from '@/config/setting'; |
| | | import DialogCloseButton from "../../components/DialogCloseButton"; |
| | | import { |
| | | useTranslate, useNotify, useRefresh, List, FilterButton, NumberField, |
| | | DateField, ReferenceInput, AutocompleteInput, TextInput, DatagridConfigurable, |
| | | BooleanField, SearchInput, |
| | | } from 'react-admin'; |
| | | import TreeSelectInput from "@/page/components/TreeSelectInput"; |
| | | import { Add, Edit, Delete, Save } from '@mui/icons-material'; |
| | | import SaveIcon from '@mui/icons-material/Save'; |
| | | import { DataGrid } from '@mui/x-data-grid'; |
| | | import request from '@/utils/request'; |
| | | |
| | | |
| | | |
| | | const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ |
| | | '& .css-1vooibu-MuiSvgIcon-root': { |
| | | height: '.9em' |
| | | }, |
| | | '& .RaDatagrid-row': { |
| | | cursor: 'auto' |
| | | }, |
| | | '& .column-name': { |
| | | }, |
| | | '& .opt': { |
| | | width: 180 |
| | | }, |
| | | })); |
| | | |
| | | |
| | | |
| | | const SelectLocsRevise = (props) => { |
| | | const { open, setOpen, data, setData } = props; |
| | | const translate = useTranslate(); |
| | | const refresh = useRefresh(); |
| | | const notify = useNotify(); |
| | | |
| | | const handleClose = (event, reason) => { |
| | | if (reason !== "backdropClick") { |
| | | setOpen(false); |
| | | } |
| | | }; |
| | | |
| | | const dicts = JSON.parse(localStorage.getItem('sys_dicts'))?.filter(dict => (dict.dictTypeCode == 'sys_stock_revise_type')) || []; |
| | | const [formData, setFormData] = useState({}); |
| | | const [tableData, setTableData] = useState([]); |
| | | const [dyFields, setDyFields] = useState([]); |
| | | const [selectedRows, setSelectedRows] = useState([]); |
| | | const [page, setPage] = useState({ page: DEFAULT_START_PAGE, pageSize: DEFAULT_PAGE_SIZE }); |
| | | const [rowCount, setRowCount] = useState(0); |
| | | const [isLoading, setIsLoading] = useState(false); |
| | | const handleChange = (e) => { |
| | | const { name, value } = e.target; |
| | | setFormData(() => ({ |
| | | [name]: value |
| | | })); |
| | | }; |
| | | |
| | | const reset = () => { |
| | | setFormData({ |
| | | name: '', |
| | | code: '', |
| | | groupId: 0 |
| | | }) |
| | | } |
| | | |
| | | const handleSubmit = () => { |
| | | const hasarr = data.map(el => +el.matnrId) |
| | | const selectedData = selectedRows.filter(item => !hasarr.includes(item)).map(id => (tableData.find(row => row.id === id))); |
| | | const value = selectedData.map((el => { |
| | | const dynamicFields = dyFields.reduce((acc, item) => { |
| | | acc[item.fields] = el['extendFields']?.[item.fields] || ''; |
| | | return acc; |
| | | }, {}); |
| | | return { |
| | | matnrId: el.id, |
| | | maktx: el.name, |
| | | matnrCode: el.code, |
| | | stockUnit: el.stockUnit || '', |
| | | purUnit: el.purchaseUnit || '', |
| | | ...dynamicFields |
| | | } |
| | | })) |
| | | setData([...data, ...value]); |
| | | setOpen(false); |
| | | reset(); |
| | | }; |
| | | |
| | | const filters = [ |
| | | <SearchInput source="condition" alwaysOn />, |
| | | ] |
| | | |
| | | const getData = async () => { |
| | | setIsLoading(true) |
| | | const res = await request.post(`/locItem/page`, { |
| | | ...formData, |
| | | current: page?.page, |
| | | pageSize: page?.pageSize, |
| | | orderBy: "create_time desc" |
| | | }); |
| | | if (res?.data?.code === 200) { |
| | | setTableData(res.data.data.records); |
| | | setRowCount(res.data?.data?.total); |
| | | |
| | | } else { |
| | | notify(res.data.msg); |
| | | } |
| | | setIsLoading(false) |
| | | |
| | | }; |
| | | |
| | | useEffect(() => { |
| | | getData(); |
| | | }, [open, page]); |
| | | |
| | | const handleSearch = () => { |
| | | getData() |
| | | }; |
| | | |
| | | return ( |
| | | <Dialog |
| | | open={open} |
| | | onClose={handleClose} |
| | | aria-labelledby="form-dialog-title" |
| | | fullWidth |
| | | disableRestoreFocus |
| | | maxWidth="xl" |
| | | > |
| | | <DialogTitle id="form-dialog-title" sx={{ |
| | | position: 'sticky', |
| | | top: 0, |
| | | backgroundColor: 'background.paper', |
| | | zIndex: 1000 |
| | | }}> |
| | | {translate("common.action.newAddMats")} |
| | | <Box sx={{ position: 'absolute', top: 8, right: 8, zIndex: 1001 }}> |
| | | <DialogCloseButton onClose={handleClose} /> |
| | | </Box> |
| | | </DialogTitle> |
| | | <DialogContent sx={{ mt: 2 }}> |
| | | {/* <Box> |
| | | <List |
| | | sx={{ |
| | | flexGrow: 1, |
| | | marginRight: 1, |
| | | transition: (theme) => |
| | | theme.transitions.create(['all'], { |
| | | duration: theme.transitions.duration.enteringScreen, |
| | | }), |
| | | }} |
| | | resource="loc" |
| | | title={"menu.loc"} |
| | | empty={false} |
| | | filter={{ useStatus: 'F' }} |
| | | filters={filters} |
| | | sort={{ field: "'row'" }} |
| | | actions={false} |
| | | perPage={DEFAULT_PAGE_SIZE} |
| | | aside={false} |
| | | > |
| | | <StyledDatagrid |
| | | preferenceKey='loc' |
| | | align="left" |
| | | bulkActionButtons={false} |
| | | rowClick={() => false} |
| | | omit={['id', 'areaId', 'type', 'barcode']} |
| | | > |
| | | <NumberField source="id" /> |
| | | <TextField source="code" label="table.field.locItem.locCode" /> |
| | | </StyledDatagrid> |
| | | </List> |
| | | </Box> */} |
| | | <Box> |
| | | <Box component="form" onSubmit={handleSubmit} sx={{ display: 'flex', flexDirection: 'column', gap: 3 }}> |
| | | <Grid container spacing={2} md={6}> |
| | | <Grid item md={4}> |
| | | <TextField |
| | | label={translate('table.field.locItem.locCode')} |
| | | name="locCode" |
| | | value={formData.name} |
| | | onChange={handleChange} |
| | | size="small" |
| | | /> |
| | | </Grid> |
| | | <Grid item md={2} sx={{ margin: 'auto' }}> |
| | | <Button variant="contained" onClick={handleSearch}>搜索</Button> |
| | | </Grid> |
| | | </Grid> |
| | | </Box> |
| | | <Box sx={{ mt: 2, height: 600, width: '100%' }}> |
| | | <AsnWareModalTable |
| | | tableData={tableData} |
| | | setTableData={setTableData} |
| | | dyFields={dyFields} |
| | | page={page} |
| | | rowCount={rowCount} |
| | | setPage={setPage} |
| | | isLoading={isLoading} |
| | | setDyFields={setDyFields} |
| | | selectedRows={selectedRows} |
| | | setSelectedRows={setSelectedRows} |
| | | /> |
| | | </Box> |
| | | </Box> |
| | | </DialogContent> |
| | | <DialogActions sx={{ position: 'sticky', bottom: 0, backgroundColor: 'background.paper', zIndex: 1000 }}> |
| | | <Box sx={{ width: '100%', display: 'flex', justifyContent: 'flex-end' }}> |
| | | <Button onClick={handleSubmit} variant="contained" startIcon={<SaveIcon />}> |
| | | {translate('toolbar.confirm')} |
| | | </Button> |
| | | </Box> |
| | | </DialogActions> |
| | | </Dialog> |
| | | ); |
| | | }; |
| | | |
| | | export default SelectLocsRevise; |
| | | |
| | | const AsnWareModalTable = ({ tableData, setTableData, page, isLoading, pageSize, setPage, rowCount, selectedRows, setSelectedRows, dyFields, setDyFields }) => { |
| | | const translate = useTranslate(); |
| | | const notify = useNotify(); |
| | | |
| | | const [columns, setColumns] = useState([ |
| | | // { field: 'id', headerName: 'ID', width: 100 }, |
| | | { field: 'locCode', headerName: translate('table.field.locItem.locCode'), width: 150 }, |
| | | { field: 'matnrCode', headerName: translate('table.field.locItem.matnrCode'), width: 200 }, |
| | | { field: 'maktx', headerName: translate('table.field.locItem.maktx'), width: 300 }, |
| | | { field: 'batch', headerName: translate('table.field.locItem.batch'), width: 100 }, |
| | | { field: 'anfme', headerName: translate('table.field.locItem.anfme'), width: 100 }, |
| | | { field: 'unit', headerName: translate('table.field.matnr.unit'), width: 100 }, |
| | | ]) |
| | | |
| | | const action = { |
| | | field: 'action', |
| | | headerName: '操作', |
| | | width: 140, |
| | | lockPosition: 'left', |
| | | renderCell: (params) => ( |
| | | <Tooltip title="Delete"> |
| | | <IconButton onClick={() => handleDelete(params.row)}> |
| | | <Delete /> |
| | | </IconButton> |
| | | <IconButton onClick={() => handleDelete(params.row)}> |
| | | <Save /> |
| | | </IconButton> |
| | | </Tooltip> |
| | | ), |
| | | } |
| | | |
| | | |
| | | const handleSelectionChange = (ids) => { |
| | | setSelectedRows(ids) |
| | | }; |
| | | |
| | | useEffect(() => { |
| | | if (dyFields.length < 1) { |
| | | getDynamicFields(); |
| | | } |
| | | }, []); |
| | | |
| | | const getDynamicFields = async () => { |
| | | const { |
| | | data: { code, data, msg }, |
| | | } = await request.get("/fields/enable/list"); |
| | | if (code === 200) { |
| | | const cols = data.map(el => ({ |
| | | field: el.fields, |
| | | headerName: el.fieldsAlise, |
| | | minWidth: 100, |
| | | flex: 1, |
| | | editable: el.unique, |
| | | valueGetter: (value, row) => { |
| | | return row.extendFields?.[el.fields] || ''; |
| | | }, |
| | | })) |
| | | setDyFields(data) |
| | | setColumns([...columns, ...cols, action]) |
| | | } else { |
| | | notify(msg); |
| | | } |
| | | } |
| | | |
| | | return ( |
| | | <div style={{ width: '100%' }}> |
| | | <DataGrid |
| | | sx={{ height: 600 }} |
| | | size="small" |
| | | rows={tableData} |
| | | columns={columns} |
| | | checkboxSelection |
| | | onRowSelectionModelChange={handleSelectionChange} |
| | | selectionModel={selectedRows} |
| | | disableColumnMenu={true} |
| | | disableColumnSorting |
| | | disableMultipleColumnsSorting |
| | | rowCount={rowCount} |
| | | paginationMode="server" |
| | | paginationModel={page} |
| | | onPaginationModelChange={setPage} |
| | | loading={isLoading} |
| | | slotProps={{ |
| | | loadingOverlay: { |
| | | variant: 'linear-progress', |
| | | noRowsVariant: 'linear-progress', |
| | | }, |
| | | }} |
| | | /> |
| | | </div> |
| | | ); |
| | | }; |