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