| | |
| | | import ConfirmButton from '../../components/ConfirmButton'; |
| | | import PageDrawer from "../../components/PageDrawer"; |
| | | import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE } from '@/config/setting'; |
| | | import ConstructionIcon from "@mui/icons-material/Construction"; |
| | | import EditIcon from '@mui/icons-material/Edit'; |
| | | import TaskIcon from '@mui/icons-material/Task'; |
| | | import CloseIcon from '@mui/icons-material/Close'; |
| | | import request from '@/utils/request'; |
| | | import DictionarySelect from "../../components/DictionarySelect"; |
| | | import ExitToAppIcon from '@mui/icons-material/ExitToApp'; |
| | | import ImportButton from "../../components/ImportButton"; |
| | | import DetailsIcon from '@mui/icons-material/Details'; |
| | | import CancelIcon from '@mui/icons-material/Cancel'; |
| | | import OutOrderCreate from "./OutOrderCreate"; |
| | | const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ |
| | | '& .css-1vooibu-MuiSvgIcon-root': { |
| | | height: '.9em' |
| | |
| | | const OutOrderList = (props) => { |
| | | const translate = useTranslate(); |
| | | const [createDialog, setCreateDialog] = useState(false); |
| | | const [manualDialog, setManualDialog] = useState(false); |
| | | const [drawerVal, setDrawerVal] = useState(false); |
| | | const [modalType, setmodalType] = useState(0); |
| | | const [select, setSelect] = useState(0); |
| | |
| | | marginRight: drawerVal ? `${PAGE_DRAWER_WIDTH}px` : 0, |
| | | }} |
| | | title={"menu.outStock"} |
| | | empty={<EmptyData onClick={() => { setCreateDialog(true); setmodalType(0) }} />} |
| | | empty={false} |
| | | filters={filters} |
| | | filter={{ deleted: 0, type: 'out' }} |
| | | sort={{ field: "create_time", order: "desc" }} |
| | | actions={( |
| | | <TopToolbar> |
| | | <FilterButton /> |
| | | <MyCreateButton onClick={() => { setCreateDialog(true); setmodalType(0) }} /> |
| | | <MyCreateButton onClick={() => { setManualDialog(true) }} /> |
| | | <SelectColumnsButton preferenceKey='outStock' /> |
| | | <ImportButton value={'asnOrderItem'} /> |
| | | <MyExportButton /> |
| | |
| | | bulkActionButtons={ |
| | | <> |
| | | <MyExportButton /> |
| | | {/* <BtnBulkExport></BtnBulkExport> */} |
| | | <BulkDeleteButton mutationMode={OPERATE_MODE} |
| | | /> |
| | | </>} |
| | |
| | | <EditButton label="toolbar.detail" icon={(<DetailsIcon />)}></EditButton> |
| | | <MyButton setCreateDialog={setCreateDialog} setmodalType={setmodalType} /> |
| | | <CancelButton></CancelButton> |
| | | {/* <CompleteButton /> */} |
| | | </WrapperField> |
| | | </StyledDatagrid> |
| | | </List> |
| | | <OutOrderCreate open={manualDialog} setOpen={setManualDialog} /> |
| | | <AsnOrderModal |
| | | open={createDialog} |
| | | setOpen={setCreateDialog} |
| | |
| | | ) |
| | | } |
| | | |
| | | const CompleteButton = () => { |
| | | const record = useRecordContext(); |
| | | const notify = useNotify(); |
| | | const refresh = useRefresh(); |
| | | const requestComplete = async () => { |
| | | const { data: { code, data, msg } } = await request.post(`/asnOrder/complete/${record.id}`); |
| | | |
| | | if (code === 200) { |
| | | notify(msg); |
| | | refresh() |
| | | } else { |
| | | notify(msg); |
| | | } |
| | | } |
| | | |
| | | return ( |
| | | record.exceStatus === 1 && (record.anfme === record.qty ? <Button onClick={requestComplete} label={"toolbar.complete"} color="success"> |
| | | <TaskIcon /> |
| | | </Button> : <ConfirmButton label={"toolbar.complete"} color="success" data={'当前收货数量小于计划数量,是否确认完成'} startIcon={<TaskIcon />} onConfirm={requestComplete} />) |
| | | |
| | | ) |
| | | } |
| | | |
| | | const CancelButton = () => { |
| | | const record = useRecordContext(); |
| | | const notify = useNotify(); |
| | | const refresh = useRefresh(); |
| | | |
| | | const cancelOrder = async () => { |
| | | const { data: { code, data, msg } } = await request.post(`/outStock/cancel/${record.id}`); |
| | | const cancelOrder = async (event) => { |
| | | event.stopPropagation(); |
| | | const { data: { code, data, msg } } = await request.get(`/outStock/cancel/${record.id}`); |
| | | if (code === 200) { |
| | | notify(msg); |
| | | refresh() |
| | |
| | | } |
| | | |
| | | return ( |
| | | <ConfirmButton label={"toolbar.cancel"} startIcon={<CancelIcon />} onConfirm={cancelOrder} /> |
| | | ) |
| | | } |
| | | |
| | | const CloseButton = () => { |
| | | const record = useRecordContext(); |
| | | const notify = useNotify(); |
| | | const refresh = useRefresh(); |
| | | const requestClose = async () => { |
| | | const { data: { code, data, msg } } = await request.post(`/outStock/close/${record.id}`); |
| | | |
| | | if (code === 200) { |
| | | notify(msg); |
| | | refresh() |
| | | } else { |
| | | notify(msg); |
| | | } |
| | | } |
| | | |
| | | return ( |
| | | <ConfirmButton label={"toolbar.close"} color="error" data={'确认是否关闭?'} startIcon={<CloseIcon />} onConfirm={requestClose} /> |
| | | <ConfirmButton label={"toolbar.cancel"} startIcon={<CancelIcon />} onConfirm={cancelOrder} /> |
| | | ) |
| | | } |