| | |
| | | CreateButton, |
| | | ExportButton, |
| | | BulkDeleteButton, |
| | | useDataProvider, |
| | | WrapperField, |
| | | useRecordContext, |
| | | useTranslate, |
| | |
| | | DeleteButton, |
| | | Button, |
| | | useRedirect, |
| | | useUnselectAll, |
| | | } from 'react-admin'; |
| | | import { Box, Typography, Card, Stack } from '@mui/material'; |
| | | import { styled } from '@mui/material/styles'; |
| | |
| | | import BillStatusField from '../../components/BillStatusField'; |
| | | import ConfirmButton from '../../components/ConfirmButton'; |
| | | import PageDrawer from "../../components/PageDrawer"; |
| | | import MyField from "../../components/MyField"; |
| | | import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE } from '@/config/setting'; |
| | | import * as Common from '@/utils/common'; |
| | | import ConstructionIcon from "@mui/icons-material/Construction"; |
| | | import FileDownloadIcon from '@mui/icons-material/FileDownload'; |
| | | 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'; |
| | | |
| | | |
| | | const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ |
| | | '& .css-1vooibu-MuiSvgIcon-root': { |
| | |
| | | |
| | | ] |
| | | |
| | | const AsnOrderList = () => { |
| | | const AsnOrderList = (props) => { |
| | | const translate = useTranslate(); |
| | | const [createDialog, setCreateDialog] = useState(false); |
| | | const [drawerVal, setDrawerVal] = useState(false); |
| | | const [modalType, setmodalType] = useState(0); |
| | | const [select, setSelect] = useState(0); |
| | | const billReload = useRef(); |
| | | const location = useLocation(); |
| | | const dicts = JSON.parse(localStorage.getItem('sys_dicts'))?.filter(dict => (dict.dictTypeCode == 'sys_business_type')) || []; |
| | | return ( |
| | | <Box display="flex"> |
| | | <List |
| | | resource="asnOrder" |
| | | sx={{ |
| | | flexGrow: 1, |
| | | transition: (theme) => |
| | |
| | | title={"menu.asnOrder"} |
| | | empty={<EmptyData onClick={() => { setCreateDialog(true); setmodalType(0) }} />} |
| | | filters={filters} |
| | | filter={{deleted: 0}} |
| | | sort={{ field: "create_time", order: "desc" }} |
| | | actions={( |
| | | <TopToolbar> |
| | |
| | | <StyledDatagrid |
| | | sx={{ width: '100%' }} |
| | | preferenceKey='asnOrder' |
| | | bulkActionButtons={<> <InspectionsButton /><BulkDeleteButton mutationMode={OPERATE_MODE} /></>} |
| | | bulkActionButtons={ |
| | | <> |
| | | <InspectionsButton /> |
| | | <MyExportButton /> |
| | | {/* <BtnBulkExport></BtnBulkExport> */} |
| | | <BulkDeleteButton mutationMode={OPERATE_MODE} |
| | | /> |
| | | </>} |
| | | rowClick={false} |
| | | expandSingle={true} |
| | | omit={['id', 'createTime', 'createBy', 'memo', 'poId', 'rleStatus$']} |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | return ( |
| | | <Button onClick={inspection} label={"toolbar.inspection"}> |
| | | <ConstructionIcon /> |
| | | </Button> |
| | | ) |
| | | } |
| | | |
| | | const BtnBulkExport = () => { |
| | | const { filter, selectedIds, filterValues, resource, sort, total } = useListContext(); |
| | | const refresh = useRefresh(); |
| | | const dataProvider = useDataProvider(); |
| | | const notify = useNotify(); |
| | | const unSelect = useUnselectAll(resource); |
| | | |
| | | const bulkExport = () => { |
| | | getExport() |
| | | unSelect(); |
| | | } |
| | | const getExport = () => { |
| | | dataProvider |
| | | .export(resource, { |
| | | ids: selectedIds, |
| | | pagination: { page: 1, perPage: 1000 }, |
| | | }) |
| | | .then((res) => { |
| | | const url = window.URL.createObjectURL( |
| | | new Blob([res.data], { type: res.headers["content-type"] }), |
| | | ); |
| | | const link = document.createElement("a"); |
| | | link.href = url; |
| | | link.setAttribute("download", `${resource}.xlsx`); |
| | | document.body.appendChild(link); |
| | | link.click(); |
| | | link.remove(); |
| | | }) |
| | | .catch((error) => { |
| | | console.error(error); |
| | | notify("ra.notification.http_error", { type: "error" }); |
| | | }); |
| | | if (typeof onClick === "function") { |
| | | onClick(event); |
| | | } |
| | | }; |
| | | |
| | | return ( |
| | | <> |
| | | <Button label="toolbar.bulkExport" onClick={bulkExport}> |
| | | <ExitToAppIcon /> |
| | | </Button> |
| | | </> |
| | | ) |
| | | } |
| | | |
| | |
| | | notify(msg); |
| | | } |
| | | } |
| | | |
| | | |
| | | return ( |
| | | record.exceStatus === 1 && (record.anfme === record.qty ? <Button onClick={requestComplete} label={"toolbar.complete"} color="success"> |