diff --git a/src/components/AutoTable/index.jsx b/src/components/AutoTable/index.jsx index ef3f51c59fb13d306e9918a13fdd1959ac1814cb..1912a598ddb062d04ab93521e6fd1a165c90c0e9 100644 --- a/src/components/AutoTable/index.jsx +++ b/src/components/AutoTable/index.jsx @@ -78,7 +78,7 @@ const AutoTable = (props) => { total = result?.data?.dataList?.length; } - setparams(total); + setparams?.(total); return { data, success, diff --git a/src/pages/myrebustrain/index.jsx b/src/pages/myrebustrain/index.jsx index cf7bbbb891dd5e8ff86a8f9adf78b436fdf28338..ee5462d961dba18f7e64250c67be92e352c06a6e 100644 --- a/src/pages/myrebustrain/index.jsx +++ b/src/pages/myrebustrain/index.jsx @@ -3,12 +3,51 @@ import PremButton from "@/components/PremButton"; import { Box, Container, Stack, Typography } from "@mui/material"; import { useParams } from "@umijs/max"; import { useMemo, useRef } from "react"; +import { useRequest } from "ahooks"; +import { doFetch } from "@/utils/doFetch"; import "./index.less"; function Record() { const actionRef = useRef(); const params = useParams(); + const { runAsync, loading } = useRequest(doFetch, { + manual: true, + onSuccess: (res) => { + if (res?.code == "0000") { + message.success("æ“作æˆåŠŸ"); + } + }, + }); + + + + const rollback = (text, row, action) => { + return ( + <PremButton + pop={{ + disabled: row?.reviewType !== 1, + title: "是å¦é€€å›žè¯¥å®žè®?", + okText: "确认", + cancelText: "å–æ¶ˆ", + onConfirm: async () => { + await runAsync({ + url: "/studentExperiment/remake", + params: { id: row?.id }, + }); + }, + }} + btn={{ + disabled: row?.reviewType !== 1, + size: "small", + color: "error", + }} + > + 撤回 + </PremButton> + ); + }; + const columns = useMemo(() => { let res = [ { title: "课程åç§°", dataIndex: "courseName", key: "courseName" }, @@ -42,6 +81,14 @@ function Record() { { label: "已批阅", value: "2" }, ], }, + { + title: "æ“作", + valueType: "option", + width: 88, + render: (text, row, _, action) => [ + rollback(text, row, _, action), + ], + }, ]; return res; }, []); diff --git a/src/pages/myrecord/index.jsx b/src/pages/myrecord/index.jsx index cea8cef7b5724de5cbb3f3708ccf517524128b62..f22948c724929345d293dede7b1be9801e66c750 100644 --- a/src/pages/myrecord/index.jsx +++ b/src/pages/myrecord/index.jsx @@ -8,6 +8,7 @@ import dayjs from "dayjs"; import duration from "dayjs/plugin/duration"; import { useMemo, useRef, useState } from "react"; import "./index.less"; +import { useRequest } from "ahooks"; dayjs.extend(duration); @@ -22,6 +23,7 @@ function Record() { open: false, })); }; + const detailcolumns = [ { title: "分数", @@ -65,6 +67,15 @@ function Record() { }, ]; + const { runAsync, loading } = useRequest(doFetch, { + manual: true, + onSuccess: (res) => { + if (res?.code == "0000") { + message.success("æ“作æˆåŠŸ"); + } + }, + }); + const detail = (text, row, _, action) => { return ( <PremButton @@ -93,6 +104,32 @@ function Record() { ); }; + const rollback = (text, row, action) => { + return ( + <PremButton + pop={{ + disabled: row?.reviewType !== 1, + title: "是å¦é€€å›žè¯¥å®žè®?", + okText: "确认", + cancelText: "å–æ¶ˆ", + onConfirm: async () => { + await runAsync({ + url: "/studentExperiment/remake", + params: { id: row?.id }, + }); + }, + }} + btn={{ + disabled: row?.reviewType !== 1, + size: "small", + color: "error", + }} + > + 撤回 + </PremButton> + ); + }; + const columns = useMemo(() => { let res = [ { title: "课程åç§°", dataIndex: "courseName", key: "courseName" }, @@ -129,8 +166,11 @@ function Record() { { title: "æ“作", valueType: "option", - width: 78, - render: (text, row, _, action) => [detail(text, row, _, action)], + width: 128, + render: (text, row, _, action) => [ + detail(text, row, _, action), + rollback(text, row, _, action), + ], }, ]; return res;