| | |
| | | import React, { useState, useRef, useEffect, useMemo, useCallback } from "react"; |
| | | import { useNavigate } from 'react-router-dom'; |
| | | import request from '@/utils/request'; |
| | | |
| | | import { |
| | | List, |
| | | DatagridConfigurable, |
| | |
| | | useRecordContext, |
| | | useTranslate, |
| | | useNotify, |
| | | useRefresh, |
| | | useListContext, |
| | | FunctionField, |
| | | TextField, |
| | |
| | | marginRight: !!drawerVal ? `${PAGE_DRAWER_WIDTH}px` : 0, |
| | | }} |
| | | title={"menu.task"} |
| | | // empty={<EmptyData onClick={() => { setCreateDialog(true) }} />} |
| | | empty={false} |
| | | filters={filters} |
| | | sort={{ field: "create_time", order: "desc" }} |
| | | sort={{ field: "sort", order: "desc" }} |
| | | actions={( |
| | | <TopToolbar> |
| | | <FilterButton /> |
| | |
| | | </WrapperField> |
| | | </StyledDatagrid> |
| | | </List> |
| | | {/* <TaskCreate |
| | | open={createDialog} |
| | | setOpen={setCreateDialog} |
| | | /> */} |
| | | <PageDrawer |
| | | title='Task Detail' |
| | | drawerVal={drawerVal} |
| | |
| | | */ |
| | | const CancelButton = () => { |
| | | const record = useRecordContext(); |
| | | const notify = useNotify(); |
| | | const refresh = useRefresh(); |
| | | const clickCancel = () => { |
| | | cancleTask([record]) |
| | | cancleTask(record) |
| | | }; |
| | | //取消任务 |
| | | const cancleTask = async (row) => {} |
| | | const cancleTask = async (row) => { |
| | | console.log(row); |
| | | const { data: { code, data, msg } } = await request.post(`/task/remove/` + row.id); |
| | | if (code === 200) { |
| | | notify(msg); |
| | | refresh(); |
| | | } else { |
| | | notify(msg); |
| | | } |
| | | } |
| | | return ( |
| | | <Button |
| | | onClick={clickCancel} |
| | |
| | | */ |
| | | const SetTopButton = () => { |
| | | const record = useRecordContext(); |
| | | const notify = useNotify(); |
| | | const refresh = useRefresh(); |
| | | const clickTop = () => { |
| | | topTask([record]) |
| | | topTask(record) |
| | | }; |
| | | //置顶任务 |
| | | const topTask = async (row) => { } |
| | | const topTask = async (row) => { |
| | | const { data: { code, data, msg } } = await request.post(`/task/top/` + row.id); |
| | | if (code === 200) { |
| | | notify(msg); |
| | | refresh(); |
| | | } else { |
| | | notify(msg); |
| | | } |
| | | } |
| | | return ( |
| | | <Button |
| | | onClick={clickTop} |
| | |
| | | cancleTask([record]) |
| | | }; |
| | | //取消任务 |
| | | const cancleTask = async (row) => {} |
| | | const cancleTask = async (row) => { } |
| | | return ( |
| | | <Button |
| | | onClick={clickCancel} |
| | |
| | | <SwapVertIcon /> |
| | | </Button> |
| | | ) |
| | | |
| | | } |