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({
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();
}}
>
提交
......
......@@ -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="请输入课程名称"
......
......@@ -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,
},
],
]}
......
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