Commit 3ba939c2 authored by wuhao's avatar wuhao 🎯

asdar

parent edd6acbb
...@@ -59,6 +59,11 @@ export default [ ...@@ -59,6 +59,11 @@ export default [
path: "/work/usercenter", path: "/work/usercenter",
component: "./usercenter", component: "./usercenter",
}, },
{
name: "实训管理",
path: "/work/bustrain",
component: "./bustrain",
},
{ {
name: "组织管理", name: "组织管理",
path: "/work/organization", path: "/work/organization",
......
...@@ -39,7 +39,14 @@ ShopProductCard.propTypes = { ...@@ -39,7 +39,14 @@ ShopProductCard.propTypes = {
product: PropTypes.object, product: PropTypes.object,
}; };
export default function ShopProductCard({ product, remove, edit, publish,authorized }) { export default function ShopProductCard({
product,
remove,
edit,
copy,
publish,
authorized,
}) {
const { courseName, picUrl, createTime, statusName, type } = product; const { courseName, picUrl, createTime, statusName, type } = product;
const [confirm, setconfirm] = useState(false); const [confirm, setconfirm] = useState(false);
const [shut, setshut] = useState(false); const [shut, setshut] = useState(false);
...@@ -145,8 +152,8 @@ export default function ShopProductCard({ product, remove, edit, publish,authori ...@@ -145,8 +152,8 @@ export default function ShopProductCard({ product, remove, edit, publish,authori
<Tooltip title="授权"> <Tooltip title="授权">
<IconButton <IconButton
onClick={() => { onClick={() => {
authorized(product) authorized(product);
}} }}
> >
<IconFont <IconFont
type="icon-shouquanguanli" type="icon-shouquanguanli"
...@@ -177,7 +184,11 @@ export default function ShopProductCard({ product, remove, edit, publish,authori ...@@ -177,7 +184,11 @@ export default function ShopProductCard({ product, remove, edit, publish,authori
)} )}
<Tooltip title="复制创建"> <Tooltip title="复制创建">
<IconButton> <IconButton
onClick={() => {
copy(product);
}}
>
<IconFont <IconFont
type="icon-fuzhi" type="icon-fuzhi"
style={{ fontSize: 20, color: "#ffffff" }} style={{ fontSize: 20, color: "#ffffff" }}
......
import { doFetch } from "@/utils/doFetch"; import { doFetch } from "@/utils/doFetch";
import { import { ArrowDownOutlined, ArrowRightOutlined } from "@ant-design/icons";
ArrowDownOutlined, import AddIcon from "@mui/icons-material/Add";
ArrowRightOutlined, import BorderColorIcon from "@mui/icons-material/BorderColor";
FormOutlined, import HorizontalRuleIcon from "@mui/icons-material/HorizontalRule";
MinusSquareOutlined,
PlusSquareOutlined,
} from "@ant-design/icons";
import EditIcon from "@mui/icons-material/Edit";
import { Box, colors, IconButton, Typography } from "@mui/material"; import { Box, colors, IconButton, Typography } from "@mui/material";
import { useRequest } from "ahooks"; import { useRequest } from "ahooks";
import { import { Input, message, Modal, Popconfirm, Tooltip, Tree } from "antd";
Divider, import { useEffect, useMemo, useState } from "react";
Input,
message,
Modal,
Popconfirm,
Tooltip,
Tree,
} from "antd";
import { createContext, useEffect, useMemo, useState } from "react";
import "./index.less"; import "./index.less";
const ReachableContext = createContext(null);
let { Search } = Input, {
{ TreeNode } = Tree; /* <TreeRender
url="/ngic-workmanship/pmMaterieType/queryTreeList"
deleteurl="/ngic-workmanship/pmMaterieType/deleteById"
saveurl="/ngic-workmanship/pmMaterieType/save"
onselected={(vals) => {
setmaterieTypeId(vals[0] ?? "");
}}
/> */
}
let { Search } = Input;
const getParentKey = (key, tree) => { const getParentKey = (key, tree) => {
let parentKey; let parentKey;
for (let i = 0; i < tree.length; i++) { for (let i = 0; i < tree.length; i++) {
...@@ -41,16 +40,6 @@ const getParentKey = (key, tree) => { ...@@ -41,16 +40,6 @@ const getParentKey = (key, tree) => {
} }
return parentKey; return parentKey;
}; };
{
/* <TreeRender
url="/ngic-workmanship/pmMaterieType/queryTreeList"
deleteurl="/ngic-workmanship/pmMaterieType/deleteById"
saveurl="/ngic-workmanship/pmMaterieType/save"
onselected={(vals) => {
setmaterieTypeId(vals[0] ?? "");
}}
/> */
}
function TreeRender({ function TreeRender({
url, url,
...@@ -75,7 +64,7 @@ function TreeRender({ ...@@ -75,7 +64,7 @@ function TreeRender({
}); });
const [expandall, setexpandall] = useState(false); const [expandall, setexpandall] = useState(false);
const [expandedKeys, onExpand] = useState(); const [expandedKeys, onExpand] = useState();
const { data, loading, refresh } = useRequest(() => { const { data, refresh } = useRequest(() => {
return doFetch({ url, params: params ?? {} }); return doFetch({ url, params: params ?? {} });
}); });
console.log(data); console.log(data);
...@@ -89,7 +78,7 @@ function TreeRender({ ...@@ -89,7 +78,7 @@ function TreeRender({
el.children && el.children.length > 0 ? fn(el.children) : ""; // 子级递归 el.children && el.children.length > 0 ? fn(el.children) : ""; // 子级递归
}); });
}; };
fn(data?.data?.data ?? []); fn(data?.data?.dataList ?? []);
return res.filter((it) => it.children).map((it) => it.key); return res.filter((it) => it.children).map((it) => it.key);
}, [data]); }, [data]);
const alldata = useMemo(() => { const alldata = useMemo(() => {
...@@ -100,11 +89,11 @@ function TreeRender({ ...@@ -100,11 +89,11 @@ function TreeRender({
el.children && el.children.length > 0 ? fn(el.children) : ""; // 子级递归 el.children && el.children.length > 0 ? fn(el.children) : ""; // 子级递归
}); });
}; };
fn(data?.data?.data ?? []); fn(data?.data?.dataList ?? []);
return res; return res;
}, [data]); }, [data]);
const treeData = useMemo(() => { const treeData = useMemo(() => {
let res = data?.data?.data ?? []; let res = data?.data?.dataList ?? [];
return [ return [
...res, ...res,
// { // {
...@@ -148,7 +137,7 @@ function TreeRender({ ...@@ -148,7 +137,7 @@ function TreeRender({
<Tooltip title={item.title} placement="topRight"> <Tooltip title={item.title} placement="topRight">
<span <span
style={{ style={{
display: "inline-block", display: "block",
maxWidth: maxWidth ?? 88, maxWidth: maxWidth ?? 88,
overflow: "hidden", overflow: "hidden",
textOverflow: "ellipsis", textOverflow: "ellipsis",
...@@ -165,7 +154,7 @@ function TreeRender({ ...@@ -165,7 +154,7 @@ function TreeRender({
<Tooltip title={item.title} placement="topRight"> <Tooltip title={item.title} placement="topRight">
<span <span
style={{ style={{
display: "inline-block", display: "block",
maxWidth: maxWidth ?? 100, maxWidth: maxWidth ?? 100,
overflow: "hidden", overflow: "hidden",
textOverflow: "ellipsis", textOverflow: "ellipsis",
...@@ -183,12 +172,13 @@ function TreeRender({ ...@@ -183,12 +172,13 @@ function TreeRender({
className="tree-item" className="tree-item"
style={{ style={{
display: "flex", display: "flex",
alignItems: "start", alignItems: "center",
justifyContent: "space-between", justifyContent: "space-between",
padding: "4px 6px",
}} }}
> >
<span style={{ marginRight: 6 }}>{title}</span> <span style={{ marginRight: 6 }}>{title}</span>
<div className="tool-item"> <div className="center" style={{gap:8}}>
{item.key && item.key != "00000000" && ( {item.key && item.key != "00000000" && (
<Tooltip <Tooltip
title="编辑" title="编辑"
...@@ -208,48 +198,47 @@ function TreeRender({ ...@@ -208,48 +198,47 @@ function TreeRender({
} }
}} }}
> >
<FormOutlined style={{ color: "#1890ff" }} /> <div className="bgs">
<BorderColorIcon style={{ color: "#1890ff", fontSize: 14 }} />
</div>
</Tooltip> </Tooltip>
)} )}
{item.key && item.key != "00000000" && item.children && (
<Divider type="vertical" style={{ margin: "0 6px" }}></Divider>
)}
{item.key && item.key != "00000000" && item.children && ( {item.key && item.key != "00000000" && item.children && (
<Tooltip title="新增"> <Tooltip title="新增">
<PlusSquareOutlined <div className="bgs">
disabled={false} <AddIcon
onClick={(e) => { disabled={false}
e.stopPropagation(); onClick={(e) => {
setsavetitle(null); e.stopPropagation();
if (true) { setsavetitle(null);
setModal({ if (true) {
visible: true, setModal({
closable: true, visible: true,
title: "新增子结构", closable: true,
okText: "新增", title: "新增子结构",
cancelText: "取消", okText: "新增",
placeholder: item.title, cancelText: "取消",
key: item.key, placeholder: item.title,
}); key: item.key,
} });
}} }
style={{ }}
color: `${true ? "green" : ""}`, style={{
}} color: `${true ? "green" : ""}`,
/> fontSize: 20,
}}
/>
</div>
</Tooltip> </Tooltip>
)} )}
{item.key != "0"&& (
<Divider type="vertical" style={{ margin: "0 6px" }}></Divider>
)}
{item.key != "0" && ( {item.key != "0" && (
<Popconfirm <Popconfirm
placement="top" placement="top"
title="是否删除该节点?" title="是否删除该节点?"
okText="删除" okText="删除"
cancelText="取消" cancelText="取消"
onConfirm={(e) => { onConfirm={() => {
console.log(111); console.log(111);
doFetch({ url: deleteurl, params: { id: item.key } }).then( doFetch({ url: deleteurl, params: { id: item.key } }).then(
(res) => { (res) => {
...@@ -262,12 +251,14 @@ function TreeRender({ ...@@ -262,12 +251,14 @@ function TreeRender({
}} }}
> >
<Tooltip title="删除"> <Tooltip title="删除">
<MinusSquareOutlined <div className="bgs">
onClick={(e) => { <HorizontalRuleIcon
e.stopPropagation(); onClick={(e) => {
}} e.stopPropagation();
style={{ color: "red" }} }}
/> style={{ color: "red", fontSize: 16 }}
/>
</div>
</Tooltip> </Tooltip>
</Popconfirm> </Popconfirm>
)} )}
...@@ -329,10 +320,12 @@ function TreeRender({ ...@@ -329,10 +320,12 @@ function TreeRender({
icon: item.icon ?? null, icon: item.icon ?? null,
}; };
}); });
useEffect(() => { useEffect(() => {
setexpandall(true); setexpandall(true);
onExpand(allkeys); onExpand(allkeys);
}, [allkeys]); }, [allkeys]);
function getAllList() { function getAllList() {
const dataLists = []; const dataLists = [];
const generateLists = (data) => { const generateLists = (data) => {
...@@ -363,9 +356,7 @@ function TreeRender({ ...@@ -363,9 +356,7 @@ function TreeRender({
setDrawer({ open: true }); setDrawer({ open: true });
}} }}
> >
<EditIcon <AddIcon style={{ fontSize: 20, color: colors.blue[600] }}></AddIcon>
style={{ fontSize: 20, color: colors.blue[100] }}
></EditIcon>
</IconButton> </IconButton>
<Modal <Modal
{...drawer} {...drawer}
...@@ -375,7 +366,7 @@ function TreeRender({ ...@@ -375,7 +366,7 @@ function TreeRender({
okText="新增" okText="新增"
cancelText="取消" cancelText="取消"
onCancel={() => { onCancel={() => {
setDrawer((s) => ({ setDrawer(() => ({
item: null, item: null,
open: false, open: false,
})); }));
......
.ant-tree-switcher{
padding-top: 4px;
}
.bgs{
width: 22px;
height: 22px;
background-color: rgba(255,255,255,1);
display: flex;
justify-content: center;
align-items: center;
border-radius: 6px;
overflow: hidden;
box-shadow: 0 0 8px #eee;
>svg{
zoom:0.9
}
}
\ No newline at end of file
...@@ -16,7 +16,7 @@ const navConfig = [ ...@@ -16,7 +16,7 @@ const navConfig = [
children: [ children: [
{ {
title: "实训管理", title: "实训管理",
path: "/work/user", path: "/work/bustrain",
icon: icon("ic-shixun"), icon: icon("ic-shixun"),
}, },
{ {
......
import DraggableDialog from "@/components/DraggableDialog";
import ImportExcel from "@/components/ImportExcel";
import InitForm from "@/components/InitForm";
import PremButton from "@/components/PremButton";
import ShopProductCard from "@/components/ProductCard";
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 { useRequest } from "ahooks";
import { Empty, message } from "antd";
import { useMemo, useState } from "react";
import "./index.less";
function Lessons() {
const [dialogprops, setdialogprops] = useState({
open: false,
});
const [params, setparams] = useState({
trainName: "",
status: null,
type: null,
});
const handleClose = () => {
setdialogprops((s) => ({
...s,
open: false,
}));
};
const { runAsync, loading } = useRequest(doFetch, {
manual: true,
onSuccess: (res, parames) => {
if (res?.code == "0000") {
handleClose();
message.success("操作成功");
datalist?.refresh();
}
},
});
const datalist = useRequest(
async () => {
let res = await doFetch({ url: "/busTrain/list", params });
return res?.data?.dataList;
},
{
debounceWait: 400,
}
);
const edit = (row) => {
setdialogprops({
open: true,
defaultFormValue: { ...row },
title: "编辑",
});
};
const copy = (row) => {
setdialogprops({
open: true,
defaultFormValue: { ...row },
title: "复制创建",
});
};
const authorized = (row) => {
doFetch({
url: "/busTrainTeacher/queryRelationTeacher",
params: { courseId: row?.id },
}).then((res) => {
if (res.code === "0000") {
setdialogprops({
open: true,
maxWidth: "xl",
defaultFormValue: { ...row },
teacherIdList: res?.data?.dataList,
title: "授权",
});
}
});
};
const remove = (row) => {
runAsync({
url: "/busTrain/delete",
params: { id: row.id },
});
};
const publish = (row, params) => {
const type = row?.type === 1 ? 2 : row?.type === 2 ? 1 : null;
const extra = params ?? { type };
runAsync({
url: "/busTrain/pubOrNotPub",
params: { id: row.id, ...extra },
});
};
const columns = useMemo(
() => [
{
title: "课程",
dataIndex: "courseId",
key: "courseId",
valueType: "select",
options: {
path: "/sysCourse/getLoginTeacherCourseSection",
params: {},
},
colProps: {
span: 24,
},
},
{ title: "实训名称", dataIndex: "trainName", key: "trainName" },
{
title: "截止日期",
dataIndex: "deadline",
key: "deadline",
valueType: "date",
},
{
title: "实训封面",
dataIndex: "pic",
key: "pic",
valueType: "uploadImage",
fieldProps: {
limit: 1,
},
colProps: {
span: 24,
},
},
],
[]
);
return (
<Container maxWidth={false}>
<DraggableDialog
handleClose={handleClose}
loading={loading}
dialogprops={dialogprops}
maxWidth={dialogprops?.maxWidth ?? "xs"}
>
{dialogprops?.title === "编辑" ||
dialogprops?.title === "新增实训" ||
dialogprops?.title === "复制创建" ? (
<InitForm
fields={columns}
defaultFormValue={dialogprops?.defaultFormValue}
onFinish={(val, extra) => {
let postdata = { ...val },
url = "/busTrain/saveOrUpdate";
switch (dialogprops?.title) {
case "编辑":
postdata = {
...val,
id: dialogprops?.defaultFormValue?.id,
};
break;
case "复制创建":
url = "/busTrain/copy";
postdata = {
...val,
id: dialogprops?.defaultFormValue?.id,
};
break;
default:
break;
}
runAsync({
url,
params: postdata,
});
}}
></InitForm>
) : (
<InitForm
defaultFormValue={{
teacherIdList: dialogprops?.teacherIdList,
}}
fields={[
{
rowKey: "id",
rowName: "id",
valueType: "FormSelectList",
dataIndex: "teacherIdList",
colProps: {
span: 24,
},
columns: [
{
title: "账号",
key: "userAccount",
dataIndex: "userAccount",
readonly: true,
},
{
title: "教师姓名",
key: "name",
dataIndex: "name",
readonly: true,
},
{
title: "学校名称",
key: "schoolName",
dataIndex: "schoolName",
readonly: true,
},
{
title: "院系名称",
key: "departmentName",
dataIndex: "departmentName",
readonly: true,
},
],
path: "/user/page",
params: {
type: "2",
},
},
]}
onFinish={(val) => {
const teacherIdList = val?.teacherIdList?.map((it) => it?.id);
runAsync({
url: "/busTrainTeacher/relationCourseTeacher",
params: {
teacherIdList,
courseId: dialogprops?.defaultFormValue?.id,
},
});
}}
/>
)}
</DraggableDialog>
<Box
display={"flex"}
justifyContent={"space-between"}
alignItems={"center"}
sx={{ mb: 2.5 }}
mt={0}
>
<Typography variant="h5">实训管理</Typography>
<Stack spacing={2} direction="row">
<ImportExcel></ImportExcel>
<PremButton
btn={{
variant: "contained",
onClick: (e) => {
e.stopPropagation();
setdialogprops({
open: true,
defaultFormValue: {},
title: "新增实训",
});
},
}}
>
新增实训
</PremButton>
</Stack>
</Box>
<Box mt={2.5}>
<Grid container spacing={3}>
{datalist?.loading && !datalist?.data ? (
PRODUCTS?.map((product, i) => {
return (
<Grid key={product.id} item xs={12} sm={4} md={3} lg={2.4}>
<ShopProductLoadingCard product={product} />
</Grid>
);
})
) : datalist?.data?.length === 0 ? (
<Grid xs={12} mt={12}>
<Empty></Empty>
</Grid>
) : (
datalist?.data?.map?.((product) => (
<Grid key={product.id} item xs={12} sm={4} md={3} lg={2.4}>
<ShopProductCard
product={product}
loading={datalist?.loading}
edit={edit}
copy={copy}
remove={remove}
publish={publish}
authorized={authorized}
/>
</Grid>
))
)}
</Grid>
</Box>
</Container>
);
}
export default Lessons;
.white {
.ant-pro-card {
background-color: #f6f6f6 !important;
}
.ant-table-tbody,td {
background-color: #f9f9f9 !important;
}
}
...@@ -226,7 +226,7 @@ function Dolessons() { ...@@ -226,7 +226,7 @@ function Dolessons() {
label: `课程目录`, label: `课程目录`,
children: ( children: (
<Grid container spacing={2}> <Grid container spacing={2}>
<Grid item xs={3}> <Grid item width={340}>
<Box boxShadow={"0 0 18px #f0f0f0"} borderRadius={2} padding={2}> <Box boxShadow={"0 0 18px #f0f0f0"} borderRadius={2} padding={2}>
<TreeRender <TreeRender
onselected={checkCourse} onselected={checkCourse}
...@@ -242,7 +242,7 @@ function Dolessons() { ...@@ -242,7 +242,7 @@ function Dolessons() {
/> />
</Box> </Box>
</Grid> </Grid>
<Grid item xs={9}> <Grid item flex={1}>
<Box boxShadow={"0 0 18px #f0f0f0"} borderRadius={2} padding={2}> <Box boxShadow={"0 0 18px #f0f0f0"} borderRadius={2} padding={2}>
<InitForm <InitForm
formRef={formRef} formRef={formRef}
......
...@@ -6,3 +6,7 @@ ...@@ -6,3 +6,7 @@
background-color: #f9f9f9 !important; background-color: #f9f9f9 !important;
} }
} }
.ant-tree{
background-color: transparent !important;
}
\ No newline at end of file
...@@ -58,6 +58,14 @@ function Lessons() { ...@@ -58,6 +58,14 @@ function Lessons() {
}); });
}; };
const copy = (row) => {
setdialogprops({
open: true,
defaultFormValue: { ...row },
title: "复制创建",
});
};
const authorized = (row) => { const authorized = (row) => {
doFetch({ doFetch({
url: "/sysCourseTeacher/queryRelationTeacher", url: "/sysCourseTeacher/queryRelationTeacher",
...@@ -125,12 +133,15 @@ function Lessons() { ...@@ -125,12 +133,15 @@ function Lessons() {
dialogprops={dialogprops} dialogprops={dialogprops}
maxWidth={dialogprops?.maxWidth ?? "xs"} maxWidth={dialogprops?.maxWidth ?? "xs"}
> >
{dialogprops?.title === "编辑" || dialogprops?.title === "新增课程" ? ( {dialogprops?.title === "编辑" ||
dialogprops?.title === "新增课程" ||
dialogprops?.title === "复制创建" ? (
<InitForm <InitForm
fields={columns} fields={columns}
defaultFormValue={dialogprops?.defaultFormValue} defaultFormValue={dialogprops?.defaultFormValue}
onFinish={(val, extra) => { onFinish={(val, extra) => {
let postdata = { ...val }; let postdata = { ...val },
url = "/sysCourse/saveOrUpdate";
switch (dialogprops?.title) { switch (dialogprops?.title) {
case "编辑": case "编辑":
postdata = { postdata = {
...@@ -138,11 +149,18 @@ function Lessons() { ...@@ -138,11 +149,18 @@ function Lessons() {
id: dialogprops?.defaultFormValue?.id, id: dialogprops?.defaultFormValue?.id,
}; };
break; break;
case "复制创建":
url = "/sysCourse/copy";
postdata = {
...val,
id: dialogprops?.defaultFormValue?.id,
};
break;
default: default:
break; break;
} }
runAsync({ runAsync({
url: "/sysCourse/saveOrUpdate", url,
params: postdata, params: postdata,
}); });
}} }}
...@@ -255,6 +273,7 @@ function Lessons() { ...@@ -255,6 +273,7 @@ function Lessons() {
product={product} product={product}
loading={datalist?.loading} loading={datalist?.loading}
edit={edit} edit={edit}
copy={copy}
remove={remove} remove={remove}
publish={publish} publish={publish}
authorized={authorized} authorized={authorized}
......
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