diff --git a/src/components/DraggableDialog/index.jsx b/src/components/DraggableDialog/index.jsx index 318d06b51a27b1a88dce9b72f62346e0e4aeaf3e..6cb36b809152d1c68a847c7c03287fca991b8c86 100644 --- a/src/components/DraggableDialog/index.jsx +++ b/src/components/DraggableDialog/index.jsx @@ -32,8 +32,9 @@ export default function DraggableDialog({ loading, formdom, maxWidth, + formRef, }) { - const formRef = React.useRef(); + const formRefs = formRef ?? React.useRef(); return ( <div> @@ -52,9 +53,15 @@ export default function DraggableDialog({ </DialogTitle> <DialogContent> {children && - React.cloneElement(children, { submitter: false, formRef })} + React.cloneElement(children, { + submitter: false, + formRef: formRefs, + })} {formdom && - React.cloneElement(formdom, { submitter: false, formRef })} + React.cloneElement(formdom, { + submitter: false, + formRef: formRefs, + })} </DialogContent> {dialogprops?.footer === false ? null : ( <DialogActions> @@ -62,7 +69,7 @@ export default function DraggableDialog({ type="reset" key="rest" onClick={() => { - formRef?.current?.resetFields(); + formRefs?.current?.resetFields(); }} > é‡ç½® @@ -76,7 +83,7 @@ export default function DraggableDialog({ startIcon={<SendOutlined />} disabled={dialogprops?.disabled} onClick={() => { - formRef?.current?.submit(); + formRefs?.current?.submit(); }} > æäº¤ diff --git a/src/pages/bustrain/index.jsx b/src/pages/bustrain/index.jsx index fb1030facdef7ef402473a37e7dd5d0cf4564a8d..678a1abb0a12588c1fb708682967a115f48f2e90 100644 --- a/src/pages/bustrain/index.jsx +++ b/src/pages/bustrain/index.jsx @@ -412,16 +412,6 @@ function Lessons() { label="已结æŸ" value={4} /> - <FormControlLabel - control={ - <Checkbox - checked={params?.typeList?.includes("5")} - color={"default"} - /> - } - label="已结æŸ" - value={5} - /> </FormGroup> <Input placeholder="请输入课程åç§°" diff --git a/src/pages/checkhomework/index.jsx b/src/pages/checkhomework/index.jsx index 253035f367cf4d40311604e3b715ec2983713fe7..1ba42ee74fffca1580175ba39ac5619c69a5accb 100644 --- a/src/pages/checkhomework/index.jsx +++ b/src/pages/checkhomework/index.jsx @@ -7,7 +7,7 @@ import { doFetch } from "@/utils/doFetch"; import { ProDescriptions } from "@ant-design/pro-components"; import { Box, Container, Stack, Typography } from "@mui/material"; import { useRequest } from "ahooks"; -import { message, Tabs } from "antd"; +import { Divider, message, Tabs } from "antd"; import { useMemo, useRef, useState } from "react"; import "./index.less"; @@ -15,7 +15,8 @@ function Checkhomework() { const actionRef = useRef(), formRef = useRef(), actionRefs = useRef(), - formRefs = useRef(); + formRefs = useRef(), + formRefc = useRef(); const [dialogprops, setdialogprops] = useState({ open: false, }); @@ -31,8 +32,8 @@ function Checkhomework() { const { runAsync, loading } = useRequest(doFetch, { manual: true, onSuccess: (res, parames) => { + if (parames?.url === "/studentExperiment/giveScore") return; if (res?.code == "0000") { - handleClose(); message.success("æ“作æˆåŠŸ"); if (active === "1") { actionRef?.current?.reload(); @@ -186,6 +187,42 @@ function Checkhomework() { ]; }, []); + const [datas, setdatas] = useState({ + tabs: [], + }); + + let blid = useRequest( + async () => { + let res = await doFetch({ + url: "/studentExperiment/queryAllByLoginTeacher", + params: {}, + }); + return res?.data?.dataList; + }, + { + refreshDeps: [], + onSuccess: (data, params) => { + setdatas((s) => ({ + ...s, + tabs: data?.map((it) => ({ + ...it, + label: it?.studentName, + key: it?.id, + })), + })); + if (dialogprops?.open) { + setdialogprops({ + open: true, + defaultFormValue: { ...data[0] }, + title: "批阅", + }); + } + + formRefc?.current?.resetFields(); + }, + } + ); + const items = [ { key: "2", @@ -234,8 +271,12 @@ function Checkhomework() { return ( <Container maxWidth={false}> <DraggableDialog - handleClose={handleClose} + handleClose={() => { + handleClose(); + actionRef?.current?.reload(); + }} loading={loading} + formRef={formRefc} dialogprops={dialogprops} maxWidth={dialogprops?.maxWidth ?? "sm"} formdom={ @@ -266,27 +307,43 @@ function Checkhomework() { }, ]} defaultFormValue={{ examineResult: "1" }} - onFinish={(val, extra) => { + onFinish={async (val, extra) => { let postdata = { ...val, id: dialogprops?.defaultFormValue?.id, }; - runAsync({ + await runAsync({ url: "/studentExperiment/giveScore", params: postdata, }); + await blid?.runAsync(); }} ></InitForm> ) } > {dialogprops?.title === "批阅" ? ( - <ProDescriptions - columns={detailcolumns} - column={2} - style={{ marginBottom: 12 }} - dataSource={dialogprops?.defaultFormValue} - ></ProDescriptions> + <> + <Tabs + items={datas?.tabs} + activeKey={dialogprops?.defaultFormValue?.id} + onChange={(key) => { + let currow = datas?.tabs?.filter((it) => it?.id == key)[0]; + setdialogprops({ + open: true, + defaultFormValue: { ...currow }, + title: "批阅", + }); + }} + ></Tabs> + <Divider style={{ marginTop: 0 }}></Divider> + <ProDescriptions + columns={detailcolumns} + column={2} + style={{ marginBottom: 12 }} + dataSource={dialogprops?.defaultFormValue} + ></ProDescriptions> + </> ) : dialogprops?.title === "详情" ? ( <Stack direction={"column"} @@ -328,13 +385,13 @@ function Checkhomework() { title: "分数", dataIndex: "score", key: "score", - span:2 + span: 2, }, { title: "评è¯", dataIndex: "comment", key: "comment", - span: 3 + span: 3, }, ], ]}