#
luxiaotao1123
2024-11-04 7f70cb15d035f0c233b9e62b9e43aa985317c908
zy-acs-flow/src/page/task/TaskList.jsx
@@ -32,6 +32,8 @@
    DeleteButton,
    FunctionField,
    Pagination,
    useNotify,
    useRefresh,
} from 'react-admin';
import { Box, Chip, Card, Stack } from '@mui/material';
import { styled } from '@mui/material/styles';
@@ -130,18 +132,46 @@
const TaskList = () => {
    const translate = useTranslate();
    const notify = useNotify();
    const refresh = useRefresh();
    const [createDialog, setCreateDialog] = useState(false);
    const [drawerVal, setDrawerVal] = useState(false);
    const [taskStsByComplete, setTaskStsByComplete] = useState(null);
    const [taskStsByCancel, setTaskStsByCancel] = useState(null);
    useEffect(() => {
        request.post('/taskSts/list', {
            uuid: 'COMPLETE'
        }, {
            headers: {
                'Content-Type': 'application/x-www-form-urlencoded'
            }
        }).then(res => {
            setTaskStsByComplete(res.data.data[0]?.id);
        })
        request.post('/taskSts/list', {
            uuid: 'CANCEL'
        }, {
            headers: {
                'Content-Type': 'application/x-www-form-urlencoded'
            }
        }).then(res => {
            setTaskStsByCancel(res.data.data[0]?.id);
        })
    }, []);
    const onComplete = (taskId) => {
        request.get("/task/complete/" + taskId).then(res => {
            const { code, msg, data } = res.data;
            if (code === 200) {
                notify(msg || 'common.response.success', { type: 'success', messageArgs: { _: msg } });
                refresh();
            } else {
                notify(msg || 'common.response.fail', { type: 'error', messageArgs: { _: msg } });
            }
        }).catch(error => {
            notify(error.message || 'common.response.fail', { type: 'error', messageArgs: { _: error.message } });
        })
    }
@@ -150,9 +180,12 @@
            const { code, msg, data } = res.data;
            if (code === 200) {
                notify(msg || 'common.response.success', { type: 'success', messageArgs: { _: msg } });
                refresh();
            } else {
                notify(msg || 'common.response.fail', { type: 'error', messageArgs: { _: msg } });
            }
        }).catch(error => {
            notify(error.message || 'common.response.fail', { type: 'error', messageArgs: { _: error.message } });
        })
    }
@@ -179,8 +212,8 @@
                        <MyExportButton />
                    </TopToolbar>
                )}
                pagination={<Pagination rowsPerPageOptions={[10, 20, 50, 100]} />}
                perPage={20}
                pagination={<Pagination rowsPerPageOptions={[10, 25, 50, 100]} />}
                perPage={25}
                aside={<TaskListAside />}
            >
                <StyledDatagrid
@@ -261,7 +294,7 @@
                    <BooleanField source="statusBool" label="common.field.status" sortable={false} />
                    <TextField source="memo" label="common.field.memo" sortable={false} />
                    <FunctionField label="common.field.opt" cellClassName="opt" render={record => (
                        (record.taskSts === 15 || true) && (
                        (record.taskSts !== taskStsByComplete && record.taskSts !== taskStsByCancel) && (
                            <>
                                <ConfirmButton
                                    label="common.action.complete"