Commit 89a3da6b authored by wuhao's avatar wuhao 🎯

asder

parent 2067db83
Pipeline #4232 failed with stages
in 3 minutes and 27 seconds
...@@ -83,6 +83,32 @@ function Checkhomework() { ...@@ -83,6 +83,32 @@ function Checkhomework() {
); );
}; };
const remove = (text, row, _) => {
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( const columns = useMemo(
() => [ () => [
{ title: "学生姓名", dataIndex: "studentName", key: "studentName" }, { title: "学生姓名", dataIndex: "studentName", key: "studentName" },
...@@ -223,10 +249,20 @@ function Checkhomework() { ...@@ -223,10 +249,20 @@ function Checkhomework() {
} }
); );
const items = [ //全部数量
let totaldata = useRequest(async () => {
let res = await doFetch({
url: "/studentExperiment/queryCountByLoginTeacher",
params: {},
});
return res?.data?.data;
}, {});
const items = useMemo(() => {
return [
{ {
key: "2", key: "2",
label: `已提交`, label: `已提交 ${totaldata?.data?.submitNum ?? 0}`,
children: ( children: (
<Box boxShadow={"0 0 18px #f0f0f0"} borderRadius={2}> <Box boxShadow={"0 0 18px #f0f0f0"} borderRadius={2}>
<AutoTable <AutoTable
...@@ -238,8 +274,11 @@ function Checkhomework() { ...@@ -238,8 +274,11 @@ function Checkhomework() {
{ {
title: "操作", title: "操作",
valueType: "option", valueType: "option",
width: 88, width: 136,
render: (text, row, _, action) => [audit(text, row, _, action)], render: (text, row, _, action) => [
audit(text, row, _, action),
remove(text, row, _, action)
],
}, },
]} ]}
path="/studentExperiment/queryPageByLoginTeacher" path="/studentExperiment/queryPageByLoginTeacher"
...@@ -251,7 +290,7 @@ function Checkhomework() { ...@@ -251,7 +290,7 @@ function Checkhomework() {
}, },
{ {
key: "1", key: "1",
label: `待提交`, label: `待提交 ${totaldata?.data?.notSubmitNum ?? 0}`,
children: ( children: (
<Box boxShadow={"0 0 18px #f0f0f0"} borderRadius={2}> <Box boxShadow={"0 0 18px #f0f0f0"} borderRadius={2}>
<AutoTable <AutoTable
...@@ -267,6 +306,7 @@ function Checkhomework() { ...@@ -267,6 +306,7 @@ function Checkhomework() {
), ),
}, },
]; ];
}, [totaldata]);
return ( return (
<Container maxWidth={false}> <Container maxWidth={false}>
......
...@@ -6,9 +6,6 @@ import ShopProductLoadingCard from "@/components/ProductCard/loading"; ...@@ -6,9 +6,6 @@ import ShopProductLoadingCard from "@/components/ProductCard/loading";
import { doFetch } from "@/utils/doFetch"; import { doFetch } from "@/utils/doFetch";
import PRODUCTS from "@/_mock/products"; import PRODUCTS from "@/_mock/products";
import { Box, Container, Grid, Stack, Typography } from "@mui/material"; import { Box, Container, Grid, Stack, Typography } from "@mui/material";
import Checkbox from "@mui/material/Checkbox";
import FormControlLabel from "@mui/material/FormControlLabel";
import FormGroup from "@mui/material/FormGroup";
import { useRequest } from "ahooks"; import { useRequest } from "ahooks";
import { Empty, Input, message,Tabs } from "antd"; import { Empty, Input, message,Tabs } from "antd";
import { useMemo, useState } from "react"; import { useMemo, useState } from "react";
......
...@@ -5,9 +5,6 @@ import ShopProductCard from "@/components/ProductCard/stucard"; ...@@ -5,9 +5,6 @@ import ShopProductCard from "@/components/ProductCard/stucard";
import { doFetch } from "@/utils/doFetch"; import { doFetch } from "@/utils/doFetch";
import PRODUCTS from "@/_mock/products"; import PRODUCTS from "@/_mock/products";
import { Box, Container, Grid, Stack, Typography } from "@mui/material"; import { Box, Container, Grid, Stack, Typography } from "@mui/material";
import Checkbox from "@mui/material/Checkbox";
import FormControlLabel from "@mui/material/FormControlLabel";
import FormGroup from "@mui/material/FormGroup";
import { useRequest } from "ahooks"; import { useRequest } from "ahooks";
import { Empty, Input, message,Tabs } from "antd"; import { Empty, Input, message,Tabs } from "antd";
import { useMemo, useState } from "react"; import { useMemo, useState } from "react";
......
...@@ -2,27 +2,65 @@ import AutoTable from "@/components/AutoTable"; ...@@ -2,27 +2,65 @@ import AutoTable from "@/components/AutoTable";
import DraggableDialog from "@/components/DraggableDialog"; import DraggableDialog from "@/components/DraggableDialog";
import InitForm from "@/components/InitForm"; import InitForm from "@/components/InitForm";
import PremButton from "@/components/PremButton"; import PremButton from "@/components/PremButton";
import SplitDesc from "@/components/SplitDesc";
import { doFetch } from "@/utils/doFetch"; import { doFetch } from "@/utils/doFetch";
import { ProDescriptions } from "@ant-design/pro-components";
import { Box, Container, Stack, Typography } from "@mui/material"; import { Box, Container, Stack, Typography } from "@mui/material";
import { useParams } from "@umijs/max"; import { useParams } from "@umijs/max";
import { useAsyncEffect, useRequest } from "ahooks"; import { useAsyncEffect, useRequest } from "ahooks";
import { message, Segmented, Tabs } from "antd"; import { Divider, message, Segmented, Tabs } from "antd";
import { useEffect, useMemo, useState } from "react"; import { useEffect, useMemo, useRef, useState } from "react";
import { history } from "umi"; import { history } from "umi";
import "./index.less"; import "./index.less";
function Dolessons() { function Dolessons() {
const params = useParams(); const params = useParams();
const formRefc = useRef();
const [lessonDetail, setlessonDetail] = useState(null), const [lessonDetail, setlessonDetail] = useState(null),
[drawer, setDrawer] = useState({ [dialogprops, setdialogprops] = useState({
open: false, open: false,
}), }),
[type, settype] = useState("1"), [type, settype] = useState("2"),
[active, setactive] = useState(); [active, setactive] = useState();
const [datas, setdatas] = useState({
tabs: [],
});
let blid = useRequest(
async () => {
let res = await doFetch({
url: "/studentExperiment/queryAllByLoginTeacher",
params: { experimentId: active },
});
return res?.data?.dataList;
},
{
refreshDeps: [active],
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 { runAsync, loading } = useRequest(doFetch, { const { runAsync, loading } = useRequest(doFetch, {
manual: true, manual: true,
onSuccess: (res, parames) => { onSuccess: (res) => {
if (res?.code == "0000") { if (res?.code == "0000") {
handleClose(); handleClose();
message.success("操作成功"); message.success("操作成功");
...@@ -40,8 +78,6 @@ function Dolessons() { ...@@ -40,8 +78,6 @@ function Dolessons() {
); );
}, []); }, []);
const list = useRequest( const list = useRequest(
async () => { async () => {
let res = await doFetch({ let res = await doFetch({
...@@ -57,54 +93,67 @@ function Dolessons() { ...@@ -57,54 +93,67 @@ function Dolessons() {
} }
); );
const ifs = useMemo(() => { const audit = (text, row, _, action) => {
let { type } = lessonDetail ?? {}; return row.reviewType == 1 ? (
return !(type === 1 || type === 3);
}, [lessonDetail]);
const edit = (text, row, _, action) => {
return (
<PremButton <PremButton
btn={{ btn={{
size: "small", size: "small",
disabled: ifs,
variant: "text", variant: "text",
onClick: () => { onClick: () => {
setDrawer((v) => ({ setdialogprops({
open: true, open: true,
defaultFormValue: { ...row }, defaultFormValue: { ...row },
title: "编辑", title: "批阅",
})); });
}, },
}} }}
> >
编辑 批阅
</PremButton>
) : (
<PremButton
btn={{
size: "small",
variant: "text",
color: "inherit",
onClick: () => {
setdialogprops({
open: true,
defaultFormValue: { ...row },
title: "详情",
maxWidth: "md",
footer: false,
});
},
}}
>
详情
</PremButton> </PremButton>
); );
}; };
const remove = (text, row, _, action) => { const remove = (text, row, _) => {
return ( return (
<PremButton <PremButton
pop={{ pop={{
disabled: ifs, disabled: row?.reviewType !== 1,
title: "是否删除该实验?", title: "是否退回该实训?",
okText: "确认", okText: "确认",
cancelText: "取消", cancelText: "取消",
onConfirm: async () => { onConfirm: async () => {
await runAsync({ await runAsync({
url: "/busTrainExperiment/remove", url: "/studentExperiment/remake",
params: { id: row?.id }, params: { id: row?.id },
}); });
}, },
}} }}
btn={{ btn={{
disabled: ifs, disabled: row?.reviewType !== 1,
size: "small", size: "small",
color: "error", color: "error",
}} }}
> >
删除 退回
</PremButton> </PremButton>
); );
}; };
...@@ -147,7 +196,7 @@ function Dolessons() { ...@@ -147,7 +196,7 @@ function Dolessons() {
}, []); }, []);
const items = useMemo(() => { const items = useMemo(() => {
return list?.data?.map((it, i) => ({ return list?.data?.map((it) => ({
key: it?.id, key: it?.id,
label: it?.experimentName, label: it?.experimentName,
children: ( children: (
...@@ -161,7 +210,7 @@ function Dolessons() { ...@@ -161,7 +210,7 @@ function Dolessons() {
valueType: "option", valueType: "option",
width: 180, width: 180,
render: (text, row, _, action) => [ render: (text, row, _, action) => [
edit(text, row, _, action), audit(text, row, _, action),
remove(text, row, _, action), remove(text, row, _, action),
], ],
}, },
...@@ -177,20 +226,8 @@ function Dolessons() { ...@@ -177,20 +226,8 @@ function Dolessons() {
})); }));
}, [list]); }, [list]);
const addHandel = (val) => {
if (active === "1") {
// 预览
} else if (active === "2") {
// 添加实验
setDrawer({ open: true, title: "添加实验" });
} else {
// 添加问题
setDrawer({ open: true, title: "添加问题" });
}
};
const handleClose = () => { const handleClose = () => {
setDrawer((s) => ({ setdialogprops((s) => ({
...s, ...s,
open: false, open: false,
})); }));
...@@ -205,170 +242,168 @@ function Dolessons() { ...@@ -205,170 +242,168 @@ function Dolessons() {
}); });
let resdata = res?.data?.data; let resdata = res?.data?.data;
setsemlist([ setsemlist([
{
value: "1",
label: `待提交(${resdata?.submitNum})`,
},
{ {
value: "2", value: "2",
label: `已提交(${resdata?.notSubmitNum})`, label: `已提交(${resdata?.notSubmitNum})`,
}, },
{
value: "1",
label: `待提交(${resdata?.submitNum})`,
},
]); ]);
}, [active]); }, [active]);
const detailcolumns = [
{ title: "学生姓名", dataIndex: "studentName", key: "studentName" },
{ title: "学生账号", dataIndex: "studentAccount", key: "studentAccount" },
{ title: "课程名称", dataIndex: "courseName", key: "courseName" },
{ title: "实训名称", dataIndex: "trainName", key: "trainName" },
{ title: "实验名称", dataIndex: "experimentName", key: "experimentName" },
{ title: "分数", dataIndex: "score", key: "score", hideInSearch: true },
{ title: "权重", dataIndex: "weight", key: "weight", hideInSearch: true },
{ title: "分数", dataIndex: "scoreWeight", key: "scoreWeight" },
{
title: "提交时间",
dataIndex: "finishTime",
key: "finishTimeRange",
},
{
title: "批阅时间",
dataIndex: "reviewTime",
key: "reviewTimeRange",
},
];
return ( return (
<Container maxWidth={false}> <Container maxWidth={false}>
<DraggableDialog <DraggableDialog
handleClose={handleClose} handleClose={() => {
dialogprops={drawer} handleClose();
}}
loading={loading} loading={loading}
maxWidth={drawer?.maxWidth ?? "sm"} formRef={formRefc}
> dialogprops={dialogprops}
{active === "2" ? ( maxWidth={dialogprops?.maxWidth ?? "sm"}
formdom={
dialogprops?.title === "批阅" && (
<InitForm <InitForm
defaultFormValue={drawer?.defaultFormValue ?? null}
fields={[ fields={[
{ {
title: "实验", title: "批阅信息",
dataIndex: "id", dataIndex: "sort",
key: "id", key: "sort",
valueType: "select", valueType: "split",
options: {
path: "/busTrainExperiment/selection",
params: { trainId: params?.id },
}, },
formItemProps: {
rules: [
{ {
required: true, title: "打分",
message: "此项为必填项", dataIndex: "score",
}, key: "score",
], colProps: { span: 24 },
},
},
{
title: "权重(%)",
dataIndex: "weight",
key: "weight",
valueType: "digit", valueType: "digit",
formItemProps: {
rules: [
{
required: true,
message: "此项为必填项",
},
],
},
}, },
{ {
title: "考试时间(分钟)", title: "评语",
dataIndex: "testTime", dataIndex: "comment",
key: "testTime", key: "comment",
valueType: "digit", valueType: "textarea",
formItemProps: { colProps: {
rules: [ span: 24,
{
required: true,
message: "此项为必填项",
},
],
},
},
{
title: "截止时间",
dataIndex: "deadline",
key: "deadline",
valueType: "date",
formItemProps: {
rules: [
{
required: true,
message: "此项为必填项",
},
],
}, },
}, },
]} ]}
onFinish={(val, extra) => { defaultFormValue={{ examineResult: "1" }}
let postdata; onFinish={async (val, extra) => {
switch (drawer?.title) { let postdata = {
case "添加实验":
postdata = {
...val,
trainId: params?.id,
};
break;
case "编辑":
postdata = {
...val, ...val,
id: drawer?.defaultFormValue?.id, id: dialogprops?.defaultFormValue?.id,
trainId: params?.id,
}; };
default: await runAsync({
break; url: "/studentExperiment/giveScore",
}
runAsync({
url: "/busTrainExperiment/update",
params: postdata, params: postdata,
}); });
await blid?.runAsync();
}} }}
onValuesChange={(curval, vals, formRef) => { ></InitForm>
if (Object.keys(curval)[0] === "id") { )
doFetch({
url: "/busTrainExperiment/detail",
params: { id: Object.values(curval)[0] },
}).then((res) => {
formRef?.current?.setFieldsValue({
weight: res?.data?.data?.weight,
});
});
} }
>
{dialogprops?.title === "批阅" ? (
<>
<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: "批阅",
});
}} }}
></InitForm> ></Tabs>
) : ( <Divider style={{ marginTop: 0 }}></Divider>
<InitForm <ProDescriptions
defaultFormValue={drawer?.defaultFormValue ?? null} columns={detailcolumns}
fields={[ column={2}
style={{ marginBottom: 12 }}
dataSource={dialogprops?.defaultFormValue}
></ProDescriptions>
</>
) : dialogprops?.title === "详情" ? (
<Stack
direction={"column"}
alignItems={"center"}
justifyContent={"center"}
gap={1}
>
<SplitDesc
columns={[
detailcolumns,
{ {
title: "问题内容", title: "批阅信息",
dataIndex: "question", dataIndex: "sort",
key: "question", key: "sort",
valueType: "textarea", valueType: "split",
}, },
[
{ {
title: "参考答案", title: "实验时长",
dataIndex: "answer", dataIndex: "useTime",
key: "answer", key: "useTime",
valueType: "textarea",
}, },
{
title: "批阅状态",
dataIndex: "reviewTypeName",
key: "reviewTypeName",
},
{
title: "批阅时间",
dataIndex: "reviewTime",
key: "reviewTime",
},
{
title: "批阅人",
dataIndex: "reviewUserName",
key: "reviewUserName",
},
{
title: "分数",
dataIndex: "score",
key: "score",
span: 2,
},
{
title: "评语",
dataIndex: "comment",
key: "comment",
span: 3,
},
],
]} ]}
onFinish={(val, extra) => { dataSource={dialogprops?.defaultFormValue}
let postdata; ></SplitDesc>
switch (drawer?.title) { </Stack>
case "添加问题": ) : null}
postdata = {
...val,
trainId: params?.id,
};
break;
case "编辑":
postdata = {
...val,
id: drawer?.defaultFormValue?.id,
trainId: params?.id,
};
default:
break;
}
runAsync({
url: "/busTrainQuestion/saveOrUpdate",
params: postdata,
});
}}
></InitForm>
)}
</DraggableDialog> </DraggableDialog>
<Box <Box
......
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