Commit 751277d6 authored by wuhao's avatar wuhao 🎯

sader

parent 58be7eb0
Pipeline #3814 passed with stages
in 3 minutes and 17 seconds
...@@ -32,8 +32,9 @@ export default function DraggableDialog({ ...@@ -32,8 +32,9 @@ export default function DraggableDialog({
loading, loading,
formdom, formdom,
maxWidth, maxWidth,
formRef,
}) { }) {
const formRef = React.useRef(); const formRefs = formRef ?? React.useRef();
return ( return (
<div> <div>
...@@ -52,9 +53,15 @@ export default function DraggableDialog({ ...@@ -52,9 +53,15 @@ export default function DraggableDialog({
</DialogTitle> </DialogTitle>
<DialogContent> <DialogContent>
{children && {children &&
React.cloneElement(children, { submitter: false, formRef })} React.cloneElement(children, {
submitter: false,
formRef: formRefs,
})}
{formdom && {formdom &&
React.cloneElement(formdom, { submitter: false, formRef })} React.cloneElement(formdom, {
submitter: false,
formRef: formRefs,
})}
</DialogContent> </DialogContent>
{dialogprops?.footer === false ? null : ( {dialogprops?.footer === false ? null : (
<DialogActions> <DialogActions>
...@@ -62,7 +69,7 @@ export default function DraggableDialog({ ...@@ -62,7 +69,7 @@ export default function DraggableDialog({
type="reset" type="reset"
key="rest" key="rest"
onClick={() => { onClick={() => {
formRef?.current?.resetFields(); formRefs?.current?.resetFields();
}} }}
> >
重置 重置
...@@ -76,7 +83,7 @@ export default function DraggableDialog({ ...@@ -76,7 +83,7 @@ export default function DraggableDialog({
startIcon={<SendOutlined />} startIcon={<SendOutlined />}
disabled={dialogprops?.disabled} disabled={dialogprops?.disabled}
onClick={() => { onClick={() => {
formRef?.current?.submit(); formRefs?.current?.submit();
}} }}
> >
提交 提交
......
...@@ -412,16 +412,6 @@ function Lessons() { ...@@ -412,16 +412,6 @@ function Lessons() {
label="已结束" label="已结束"
value={4} value={4}
/> />
<FormControlLabel
control={
<Checkbox
checked={params?.typeList?.includes("5")}
color={"default"}
/>
}
label="已结束"
value={5}
/>
</FormGroup> </FormGroup>
<Input <Input
placeholder="请输入课程名称" placeholder="请输入课程名称"
......
...@@ -7,7 +7,7 @@ import { doFetch } from "@/utils/doFetch"; ...@@ -7,7 +7,7 @@ import { doFetch } from "@/utils/doFetch";
import { ProDescriptions } from "@ant-design/pro-components"; import { ProDescriptions } from "@ant-design/pro-components";
import { Box, Container, Stack, Typography } from "@mui/material"; import { Box, Container, Stack, Typography } from "@mui/material";
import { useRequest } from "ahooks"; import { useRequest } from "ahooks";
import { message, Tabs } from "antd"; import { Divider, message, Tabs } from "antd";
import { useMemo, useRef, useState } from "react"; import { useMemo, useRef, useState } from "react";
import "./index.less"; import "./index.less";
...@@ -15,7 +15,8 @@ function Checkhomework() { ...@@ -15,7 +15,8 @@ function Checkhomework() {
const actionRef = useRef(), const actionRef = useRef(),
formRef = useRef(), formRef = useRef(),
actionRefs = useRef(), actionRefs = useRef(),
formRefs = useRef(); formRefs = useRef(),
formRefc = useRef();
const [dialogprops, setdialogprops] = useState({ const [dialogprops, setdialogprops] = useState({
open: false, open: false,
}); });
...@@ -31,8 +32,8 @@ function Checkhomework() { ...@@ -31,8 +32,8 @@ function Checkhomework() {
const { runAsync, loading } = useRequest(doFetch, { const { runAsync, loading } = useRequest(doFetch, {
manual: true, manual: true,
onSuccess: (res, parames) => { onSuccess: (res, parames) => {
if (parames?.url === "/studentExperiment/giveScore") return;
if (res?.code == "0000") { if (res?.code == "0000") {
handleClose();
message.success("操作成功"); message.success("操作成功");
if (active === "1") { if (active === "1") {
actionRef?.current?.reload(); actionRef?.current?.reload();
...@@ -186,6 +187,42 @@ function Checkhomework() { ...@@ -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 = [ const items = [
{ {
key: "2", key: "2",
...@@ -234,8 +271,12 @@ function Checkhomework() { ...@@ -234,8 +271,12 @@ function Checkhomework() {
return ( return (
<Container maxWidth={false}> <Container maxWidth={false}>
<DraggableDialog <DraggableDialog
handleClose={handleClose} handleClose={() => {
handleClose();
actionRef?.current?.reload();
}}
loading={loading} loading={loading}
formRef={formRefc}
dialogprops={dialogprops} dialogprops={dialogprops}
maxWidth={dialogprops?.maxWidth ?? "sm"} maxWidth={dialogprops?.maxWidth ?? "sm"}
formdom={ formdom={
...@@ -266,27 +307,43 @@ function Checkhomework() { ...@@ -266,27 +307,43 @@ function Checkhomework() {
}, },
]} ]}
defaultFormValue={{ examineResult: "1" }} defaultFormValue={{ examineResult: "1" }}
onFinish={(val, extra) => { onFinish={async (val, extra) => {
let postdata = { let postdata = {
...val, ...val,
id: dialogprops?.defaultFormValue?.id, id: dialogprops?.defaultFormValue?.id,
}; };
runAsync({ await runAsync({
url: "/studentExperiment/giveScore", url: "/studentExperiment/giveScore",
params: postdata, params: postdata,
}); });
await blid?.runAsync();
}} }}
></InitForm> ></InitForm>
) )
} }
> >
{dialogprops?.title === "批阅" ? ( {dialogprops?.title === "批阅" ? (
<ProDescriptions <>
columns={detailcolumns} <Tabs
column={2} items={datas?.tabs}
style={{ marginBottom: 12 }} activeKey={dialogprops?.defaultFormValue?.id}
dataSource={dialogprops?.defaultFormValue} onChange={(key) => {
></ProDescriptions> 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 === "详情" ? ( ) : dialogprops?.title === "详情" ? (
<Stack <Stack
direction={"column"} direction={"column"}
...@@ -328,13 +385,13 @@ function Checkhomework() { ...@@ -328,13 +385,13 @@ function Checkhomework() {
title: "分数", title: "分数",
dataIndex: "score", dataIndex: "score",
key: "score", key: "score",
span:2 span: 2,
}, },
{ {
title: "评语", title: "评语",
dataIndex: "comment", dataIndex: "comment",
key: "comment", key: "comment",
span: 3 span: 3,
}, },
], ],
]} ]}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment