skyouc
2 天以前 37467bf7d119ef9b599f1c19b869d046d730b7cb
rsf-admin/src/page/orders/wave/WaveList.jsx
@@ -48,6 +48,8 @@
import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE } from '@/config/setting';
import * as Common from '@/utils/common';
import PublicIcon from '@mui/icons-material/Public';
import ItemToTaskModal from "./ItemToTaskModal";
import ConfirmButton from "../../components/ConfirmButton";
const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({
@@ -60,7 +62,7 @@
    '& .column-name': {
    },
    '& .opt': {
        width: 200
        width: 260
    },
}));
@@ -68,7 +70,6 @@
    <SearchInput source="condition" alwaysOn />,
    <DateInput label='common.time.after' source="timeStart" alwaysOn />,
    <DateInput label='common.time.before' source="timeEnd" alwaysOn />,
    <TextInput source="code" label="table.field.wave.code" />,
    <SelectInput source="type" label="table.field.wave.type"
        choices={[
@@ -87,7 +88,6 @@
    <NumberInput source="anfme" label="table.field.wave.anfme" />,
    <NumberInput source="qty" label="table.field.wave.qty" />,
    <NumberInput source="orderNum" label="table.field.wave.orderNum" />,
    <TextInput label="common.field.memo" source="memo" />,
    <SelectInput
        label="common.field.status"
@@ -103,6 +103,8 @@
const WaveList = () => {
    const translate = useTranslate();
    const [createDialog, setCreateDialog] = useState(false);
    const [detailDialog, setDetailDialog] = useState(false);
    const [select, setSelectIds] = useState({});
    const [drawerVal, setDrawerVal] = useState(false);
    return (
@@ -130,9 +132,7 @@
            >
                <StyledDatagrid
                    preferenceKey='wave'
                    bulkActionButtons={
                        <PublicTaskButton />
                    }
                    bulkActionButtons={false}
                    rowClick={(id, resource, record) => false}
                    expand={false}
                    expandSingle={false}
@@ -152,11 +152,17 @@
                    <BooleanField source="statusBool" label="common.field.status" sortable={false} />
                    <TextField source="memo" label="common.field.memo" sortable={false} />
                    <WrapperField cellClassName="opt" label="common.field.opt">
                        <PublicTaskButton setSelectIds={setSelectIds} setDetailDialog={setDetailDialog} />
                        <EditButton sx={{ padding: '1px', fontSize: '.75rem' }} />
                        <DeleteButton sx={{ padding: '1px', fontSize: '.75rem' }} mutationMode={OPERATE_MODE} />
                    </WrapperField>
                </StyledDatagrid>
            </List>
            <ItemToTaskModal
                open={detailDialog}
                record={select}
                setOpen={setDetailDialog}
            />
            <WaveCreate
                open={createDialog}
                setOpen={setCreateDialog}
@@ -173,32 +179,16 @@
export default WaveList;
const PublicTaskButton = () => {
const PublicTaskButton = ({ setSelectIds, setDetailDialog }) => {
    const record = useRecordContext();
    const { selectedIds, onUnselectItems } = useListContext();
    const notify = useNotify();
    const refresh = useRefresh();
    const redirect = useRedirect();
    const pubClick = async (event) => {
        event.stopPropagation();
        console.log('=========>');
        onUnselectItems();
        const res = await request.post(`/wave/public/task`, { ids: selectedIds });
        if (res?.data?.code === 200) {
            notify(res.data.msg);
            redirect("/task")
        } else {
            notify(res.data.msg);
        }
        refresh();
        setSelectIds(record);
        setDetailDialog(true);
    }
    return (
        <Button
            onClick={pubClick}
            label={"toolbar.createTask"}
            startIcon={<PublicIcon />}
        />);
        <ConfirmButton label={"toolbar.createTask"} startIcon={<PublicIcon />} onConfirm={pubClick} />
    );
}