Commit d26c98f3 authored by wuhao's avatar wuhao 🎯

asder

parent b6e682fa
Pipeline #6396 passed with stages
in 7 minutes and 36 seconds
......@@ -54,7 +54,7 @@ function Checkhomework() {
variant: "text",
onClick: async () => {
let res = await doFetch({
url: "/studentExperiment/queryResult",
url: "/studentExperiment/queryResultForPc",
params: {
id: row.id,
},
......@@ -403,7 +403,7 @@ function Checkhomework() {
onChange={async (key) => {
let currow = datas?.tabs?.filter((it) => it?.id == key)[0];
let res = await doFetch({
url: "/studentExperiment/queryResult",
url: "/studentExperiment/queryResultForPc",
params: {
id: currow.id,
},
......
......@@ -161,16 +161,7 @@ function Dolessons() {
key: "experimentName",
formItemProps: { rules: [{ required: true, message: "此项为必填项" }] },
render: (_, row) => {
return (
<Link
underline="hover"
href={row?.url}
target="_blank"
rel="noopener"
>
{row?.experimentName}
</Link>
);
return row?.experimentName;
},
search: false,
},
......
......@@ -6,7 +6,7 @@ import OnlineChat from "@/components/OnlineChat";
import PremButton from "@/components/PremButton";
import TreeRender from "@/components/TreeRender/sxtree";
import { doFetch } from "@/utils/doFetch";
import { Box, Container, Grid, Link, Stack, Typography } from "@mui/material";
import { Box, Container, Grid, Stack, Typography } from "@mui/material";
import { useParams } from "@umijs/max";
import { useRequest } from "ahooks";
import { message, Tabs } from "antd";
......@@ -113,6 +113,38 @@ function Dolessons() {
);
};
const openActive = (text, row, _, action) => {
return (
<PremButton
pop={{
title: "确认开始该实验?",
okText: "确认",
cancelText: "取消",
onConfirm: async () => {
await runAsync({
url: "/studentExperiment/startExperiment",
params: { id: row?.id },
});
// add Jump
},
}}
btn={{
size: "small",
color: "error",
}}
>
开始实验
</PremButton>
);
};
const questionColumns = useMemo(() => {
let col = [
{
......@@ -140,16 +172,7 @@ function Dolessons() {
key: "experimentName",
formItemProps: { rules: [{ required: true, message: "此项为必填项" }] },
render: (_, row) => {
return (
<Link
underline="hover"
href={row?.url}
target="_blank"
rel="noopener"
>
{row?.experimentName}
</Link>
);
return row?.experimentName;
},
search: false,
},
......@@ -241,7 +264,17 @@ function Dolessons() {
<AutoTable
rerendered={false}
actionRef={cksyactionRef}
columns={[...experimentColumns]}
columns={[
...experimentColumns,
{
title: "操作",
valueType: "option",
width: 180,
render: (text, row, _, action) => [
openActive(text, row, _, action),
],
},
]}
path="/studentTrain/experimentPage"
extraparams={{
id: params?.id,
......
import AutoTable from "@/components/AutoTable";
import DraggableDialog from "@/components/DraggableDialog";
import PointViewer from "@/components/PointViewer";
import PremButton from "@/components/PremButton";
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 { Divider, Drawer, message, Table, Tag, Tooltip } from "antd";
import dayjs from "dayjs";
import duration from "dayjs/plugin/duration";
import { useMemo, useRef, useState } from "react";
import "./index.less";
import { useRequest } from "ahooks";
dayjs.extend(duration);
......@@ -23,7 +26,7 @@ function Record() {
open: false,
}));
};
const detailcolumns = [
{
title: "分数",
......@@ -89,12 +92,20 @@ function Record() {
params: { id: row?.id },
});
let result = await doFetch({
url: "/studentExperiment/queryResultForPc",
params: {
id: row.id,
},
});
setdialogprops({
open: true,
defaultFormValue: { ...res?.data?.data },
title: "详情",
maxWidth: "md",
footer: false,
tabdata: result?.data?.data,
});
},
}}
......@@ -176,6 +187,16 @@ function Record() {
return res;
}, []);
const [drawer, setDrawer] = useState({
open: false,
onClose: () => {
setDrawer((s) => ({
...s,
open: false,
}));
},
});
return (
<Container maxWidth={false}>
<DraggableDialog
......@@ -184,12 +205,178 @@ function Record() {
maxWidth={dialogprops?.maxWidth ?? "sm"}
footer={false}
>
<ProDescriptions
columns={detailcolumns}
column={2}
style={{ marginBottom: 12 }}
dataSource={dialogprops?.defaultFormValue}
></ProDescriptions>
<div>
<ProDescriptions
columns={detailcolumns}
column={2}
style={{ marginBottom: 12 }}
dataSource={dialogprops?.defaultFormValue}
></ProDescriptions>
<Divider></Divider>
<b style={{ fontSize: 14, paddingBottom: 10, display: "block" }}>
实验素养
</b>
<Table
size="small"
pagination={{
pageSize: 6,
}}
columns={[
{
title: "操作名称",
dataIndex: "config",
key: "config",
render: (text, row) => {
return row?.config?.name;
},
},
{
title: "是否操作",
dataIndex: "isComplete",
key: "isComplete",
width: 200,
render: (text, row) => {
return row?.isComplete ? (
"完成"
) : (
<span style={{ color: "red" }}>未完成</span>
);
},
},
]}
dataSource={
dialogprops?.tabdata?.recordDataDic
? Object.values(dialogprops?.tabdata?.recordDataDic)
: []
}
></Table>
<Divider></Divider>
<div style={{ position: "relative", minHeight: 360 }}>
<Drawer
{...drawer}
getContainer={false}
title={false}
closable={false}
destroyOnClose
>
<PointViewer
position={drawer?.position}
CoordinatePoint={dialogprops?.tabdata?.CoordinatePoint}
CurGongjianPoint={dialogprops?.tabdata?.CurGongjianPoint}
></PointViewer>
</Drawer>
<b style={{ fontSize: 14, paddingBottom: 10, display: "block" }}>
实验报告
</b>
<Table
size="small"
pagination={{
pageSize: 6,
}}
columns={[
{
title: "名称",
dataIndex: "Name",
key: "Name",
},
{
title: "测量值",
dataIndex: "actualValue",
key: "actualValue",
render: (text, row) => {
return row?.actualValue?.toFixed(4) ?? "";
},
},
{
title: "名义值",
dataIndex: "normal",
key: "normal",
render: (text, row) => {
return row?.normal?.toFixed(4) ?? "";
},
},
{
title: "上公差",
dataIndex: "Upper",
key: "Upper",
},
{
title: "下公差",
dataIndex: "Down",
key: "Down",
},
]}
rowKey={"id"}
dataSource={
dialogprops?.tabdata?.PeculiarityInfosDict
? Object.values(
dialogprops?.tabdata?.PeculiarityInfosDict
)?.map((it, i) =>
it?.[0]
? {
...it?.[0],
id: i + 1,
}
: {}
)
: []
}
expandable={{
expandedRowRender: ({ ElementInfoList }) => {
return (
<div style={{ display: "flex", gap: 6 }}>
{ElementInfoList?.map((it) => {
function removeFirstAndLastChar(str) {
return str.substring(1, str.length - 1);
}
return (
<div
style={{
padding: 12,
backgroundColor: "#f0f0f0",
display: "inline-block",
borderRadius: 4,
marginBottom: 6,
}}
>
<span style={{ paddingRight: 12 }}>{it?.Name}</span>
{it?.PointList?.map((its) => (
<Tooltip
key={its?.id}
title={
<div
dangerouslySetInnerHTML={{
__html: removeFirstAndLastChar(
JSON.stringify(its.Position)
).replace(/,/g, "<br/>"),
}}
></div>
}
>
<Tag
onClick={() => {
setDrawer((s) => ({
...s,
position: its.Position,
open: true,
}));
}}
style={{ cursor: "pointer" }}
>
{its.Name}
</Tag>
</Tooltip>
))}
</div>
);
})}
</div>
);
},
}}
></Table>
</div>
</div>
</DraggableDialog>
<Stack direction={"row"} mb={2}>
......
......@@ -8,8 +8,9 @@ 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 { Divider, message, Segmented, Tabs } from "antd";
import { Divider, message, Segmented, Table, Tabs,Drawer } from "antd";
import { useEffect, useMemo, useRef, useState } from "react";
import PointViewer from "@/components/PointViewer";
import { history } from "umi";
import "./index.less";
......@@ -99,11 +100,18 @@ function Dolessons() {
btn={{
size: "small",
variant: "text",
onClick: () => {
onClick: async () => {
let res = await doFetch({
url: "/studentExperiment/queryResultForPc",
params: {
id: row.id,
},
});
setdialogprops({
open: true,
defaultFormValue: { ...row },
title: "批阅",
tabdata: res?.data?.data,
});
},
}}
......@@ -274,6 +282,16 @@ function Dolessons() {
},
];
const [drawer, setDrawer] = useState({
open: false,
onClose: () => {
setDrawer((s) => ({
...s,
open: false,
}));
},
});
return (
<Container maxWidth={false}>
<DraggableDialog
......@@ -283,7 +301,7 @@ function Dolessons() {
loading={loading}
formRef={formRefc}
dialogprops={dialogprops}
maxWidth={dialogprops?.maxWidth ?? "sm"}
maxWidth={dialogprops?.maxWidth ?? "md"}
formdom={
dialogprops?.title === "批阅" && (
<InitForm
......@@ -332,12 +350,19 @@ function Dolessons() {
<Tabs
items={datas?.tabs}
activeKey={dialogprops?.defaultFormValue?.id}
onChange={(key) => {
onChange={async (key) => {
let currow = datas?.tabs?.filter((it) => it?.id == key)[0];
let res = await doFetch({
url: "/studentExperiment/queryResultForPc",
params: {
id: currow.id,
},
});
setdialogprops({
open: true,
defaultFormValue: { ...currow },
title: "批阅",
tabdata: res?.data?.data,
});
}}
></Tabs>
......@@ -348,6 +373,175 @@ function Dolessons() {
style={{ marginBottom: 12 }}
dataSource={dialogprops?.defaultFormValue}
></ProDescriptions>
<Divider></Divider>
<b style={{ fontSize: 14, paddingBottom: 10, display: "block" }}>
实验素养
</b>
<Table
size="small"
pagination={{
pageSize: 6,
}}
columns={[
{
title: "操作名称",
dataIndex: "config",
key: "config",
render: (text, row) => {
return row?.config?.name;
},
},
{
title: "是否操作",
dataIndex: "isComplete",
key: "isComplete",
width: 200,
render: (text, row) => {
return row?.isComplete ? (
"完成"
) : (
<span style={{ color: "red" }}>未完成</span>
);
},
},
]}
dataSource={
dialogprops?.tabdata?.recordDataDic
? Object.values(dialogprops?.tabdata?.recordDataDic)
: []
}
></Table>
<Divider></Divider>
<div style={{ position: "relative", minHeight: 360 }}>
<Drawer
{...drawer}
getContainer={false}
title={false}
closable={false}
destroyOnClose
>
<PointViewer
position={drawer?.position}
CoordinatePoint={dialogprops?.tabdata?.CoordinatePoint}
CurGongjianPoint={dialogprops?.tabdata?.CurGongjianPoint}
></PointViewer>
</Drawer>
<b style={{ fontSize: 14, paddingBottom: 10, display: "block" }}>
实验报告
</b>
<Table
size="small"
pagination={{
pageSize: 6,
}}
columns={[
{
title: "名称",
dataIndex: "Name",
key: "Name",
},
{
title: "测量值",
dataIndex: "actualValue",
key: "actualValue",
render: (text, row) => {
return row?.actualValue?.toFixed(4) ?? "";
},
},
{
title: "名义值",
dataIndex: "normal",
key: "normal",
render: (text, row) => {
return row?.normal?.toFixed(4) ?? "";
},
},
{
title: "上公差",
dataIndex: "Upper",
key: "Upper",
},
{
title: "下公差",
dataIndex: "Down",
key: "Down",
},
]}
rowKey={"id"}
dataSource={
dialogprops?.tabdata?.PeculiarityInfosDict
? Object.values(
dialogprops?.tabdata?.PeculiarityInfosDict
)?.map((it, i) =>
it?.[0]
? {
...it?.[0],
id: i + 1,
}
: {}
)
: []
}
expandable={{
expandedRowRender: ({ ElementInfoList }) => {
return (
<div style={{ display: "flex", gap: 6 }}>
{ElementInfoList?.map((it) => {
function removeFirstAndLastChar(str) {
return str.substring(1, str.length - 1);
}
return (
<div
style={{
padding: 12,
backgroundColor: "#f0f0f0",
display: "inline-block",
borderRadius: 4,
marginBottom: 6,
}}
>
<span style={{ paddingRight: 12 }}>
{it?.Name}
</span>
{it?.PointList?.map((its) => (
<Tooltip
key={its?.id}
title={
<div
dangerouslySetInnerHTML={{
__html: removeFirstAndLastChar(
JSON.stringify(its.Position)
).replace(/,/g, "<br/>"),
}}
></div>
}
>
<Tag
onClick={() => {
setDrawer((s) => ({
...s,
position: its.Position,
open: true,
}));
}}
style={{ cursor: "pointer" }}
>
{its.Name}
</Tag>
</Tooltip>
))}
</div>
);
})}
</div>
);
},
}}
></Table>
</div>
</>
) : dialogprops?.title === "详情" ? (
<Stack
......
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