Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cs_vsofpm
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wuhao
cs_vsofpm
Commits
10337167
Commit
10337167
authored
May 10, 2023
by
wuhao
🎯
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
daer
parent
adbe0ad2
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
1245 additions
and
58 deletions
+1245
-58
routes.ts
config/routes.ts
+5
-0
index.jsx
src/components/ImportExcel/index.jsx
+1
-1
index.jsx
src/components/InitForm/EditTable/index.jsx
+1
-0
sxcard.jsx
src/components/ProductCard/sxcard.jsx
+5
-6
index.jsx
src/components/TreeRender/index.jsx
+2
-6
sxtree.jsx
src/components/TreeRender/sxtree.jsx
+523
-0
index.jsx
src/pages/bustrain/index.jsx
+35
-37
index.jsx
src/pages/dobustrain/index.jsx
+558
-0
index.less
src/pages/dobustrain/index.less
+12
-0
index.jsx
src/pages/lessons/index.jsx
+103
-8
No files found.
config/routes.ts
View file @
10337167
...
...
@@ -104,6 +104,11 @@ export default [
path
:
"/work/dolessons/:id"
,
component
:
"./dolessons"
,
},
{
name
:
"备课"
,
path
:
"/work/dobustrain/:id"
,
component
:
"./dobustrain"
,
},
],
},
{
...
...
src/components/ImportExcel/index.jsx
View file @
10337167
...
...
@@ -8,7 +8,7 @@ function ImportExcel() {
return
(
<>
<
Stack
direction=
{
"row"
}
gap=
{
1
}
>
<
Stack
direction=
{
"row"
}
>
<
Button
variant=
"outlined"
onClick=
{
()
=>
{
...
...
src/components/InitForm/EditTable/index.jsx
View file @
10337167
...
...
@@ -155,6 +155,7 @@ const EditTable = (props) => {
}
}
search=
{
{
filterType
:
'light'
,
//轻量模式
placement
:
"bottomLeft"
}
}
/>
);
...
...
src/components/ProductCard/sxcard.jsx
View file @
10337167
...
...
@@ -19,10 +19,10 @@ import AccessTimeFilledIcon from "@mui/icons-material/AccessTimeFilled";
import
CheckIcon
from
"@mui/icons-material/Check"
;
import
DeleteIcon
from
"@mui/icons-material/Delete"
;
import
EditIcon
from
"@mui/icons-material/Edit"
;
import
GroupIcon
from
"@mui/icons-material/Group"
;
import
{
history
}
from
"@umijs/max"
;
import
{
Progress
}
from
"antd"
;
import
dayjs
from
"dayjs"
;
import
GroupIcon
from
'@mui/icons-material/Group'
;
import
{
useState
}
from
"react"
;
// ----------------------------------------------------------------------
...
...
@@ -60,7 +60,6 @@ export default function ShopProductCard({
studentNum
,
totalSubmitExperimentNum
,
totalExperimentNum
,
}
=
product
;
const
[
confirm
,
setconfirm
]
=
useState
(
false
);
...
...
@@ -174,7 +173,7 @@ export default function ShopProductCard({
></
GroupIcon
>
</
IconButton
>
</
Tooltip
>
<
Tooltip
title=
{
"成绩管理"
}
>
<
IconButton
onClick=
{
()
=>
{
...
...
@@ -276,7 +275,7 @@ export default function ShopProductCard({
direction=
{
"row"
}
alignItems=
{
"center"
}
onClick=
{
()
=>
{
history
.
push
(
"/work/do
lessons
/"
+
product
.
id
);
history
.
push
(
"/work/do
bustrain
/"
+
product
.
id
);
}
}
sx=
{
{
cursor
:
"pointer"
}
}
>
...
...
@@ -306,10 +305,10 @@ export default function ShopProductCard({
<
Stack
direction=
{
"row"
}
alignItems=
{
"center"
}
sx=
{
{
cursor
:
"pointer"
}
}
onClick=
{
()
=>
{
history
.
push
(
"/work/dolessons/"
+
product
.
id
);
authorized
(
product
);
}
}
sx=
{
{
cursor
:
"pointer"
}
}
>
<
IconFont
type=
"icon-shouquanguanli"
...
...
src/components/TreeRender/index.jsx
View file @
10337167
...
...
@@ -178,7 +178,7 @@ function TreeRender({
}
}
>
<
span
style=
{
{
marginRight
:
6
}
}
>
{
title
}
</
span
>
<
div
className=
"center"
style=
{
{
gap
:
8
}
}
>
<
div
className=
"center"
style=
{
{
gap
:
8
}
}
>
{
item
.
key
&&
item
.
key
!=
"00000000"
&&
(
<
Tooltip
title=
"编辑"
...
...
@@ -239,7 +239,6 @@ function TreeRender({
okText=
"删除"
cancelText=
"取消"
onConfirm=
{
()
=>
{
console
.
log
(
111
);
doFetch
({
url
:
deleteurl
,
params
:
{
id
:
item
.
key
}
}).
then
(
(
res
)
=>
{
if
(
res
.
code
==
"0000"
)
{
...
...
@@ -250,12 +249,9 @@ function TreeRender({
);
}
}
>
<
Tooltip
title=
"删除"
>
<
Tooltip
title=
"删除"
placement=
"bottom"
>
<
div
className=
"bgs"
>
<
HorizontalRuleIcon
onClick=
{
(
e
)
=>
{
e
.
stopPropagation
();
}
}
style=
{
{
color
:
"red"
,
fontSize
:
16
}
}
/>
</
div
>
...
...
src/components/TreeRender/sxtree.jsx
0 → 100644
View file @
10337167
import
{
doFetch
}
from
"@/utils/doFetch"
;
import
{
ArrowDownOutlined
,
ArrowRightOutlined
}
from
"@ant-design/icons"
;
import
AddIcon
from
"@mui/icons-material/Add"
;
import
BorderColorIcon
from
"@mui/icons-material/BorderColor"
;
import
HorizontalRuleIcon
from
"@mui/icons-material/HorizontalRule"
;
import
{
Box
,
colors
,
IconButton
,
Typography
}
from
"@mui/material"
;
import
{
useRequest
}
from
"ahooks"
;
import
{
Input
,
message
,
Modal
,
Popconfirm
,
Tooltip
,
Tree
}
from
"antd"
;
import
{
useEffect
,
useMemo
,
useState
}
from
"react"
;
import
"./index.less"
;
{
/* <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
)
=>
{
let
parentKey
;
for
(
let
i
=
0
;
i
<
tree
.
length
;
i
++
)
{
const
node
=
tree
[
i
];
if
(
node
.
children
)
{
if
(
node
.
children
.
some
((
item
)
=>
{
return
item
.
key
===
key
;
})
)
{
parentKey
=
node
.
key
;
}
else
if
(
getParentKey
(
key
,
node
.
children
))
{
parentKey
=
getParentKey
(
key
,
node
.
children
);
}
}
}
return
parentKey
;
};
function
TreeRender
({
url
,
deleteurl
,
saveurl
,
onselected
,
params
,
noaction
,
maxWidth
,
style
,
submitKey
,
})
{
const
[
search
,
setsearch
]
=
useState
(
""
);
const
[
savetitle
,
setsavetitle
]
=
useState
(
null
);
const
[
modal
,
setModal
]
=
useState
({
visible
:
false
,
}),
[
drawer
,
setDrawer
]
=
useState
({
item
:
null
,
open
:
false
,
});
const
[
expandall
,
setexpandall
]
=
useState
(
false
);
const
[
expandedKeys
,
onExpand
]
=
useState
();
const
{
data
,
refresh
}
=
useRequest
(()
=>
{
return
doFetch
({
url
,
params
:
params
??
{}
});
});
console
.
log
(
data
);
const
[
autoExpandParent
,
setAutoExpandParent
]
=
useState
(
true
);
const
allkeys
=
useMemo
(()
=>
{
let
res
=
[];
const
fn
=
(
source
)
=>
{
source
?.
map
((
el
)
=>
{
res
.
push
(
el
);
el
.
children
&&
el
.
children
.
length
>
0
?
fn
(
el
.
children
)
:
""
;
// 子级递归
});
};
fn
(
data
?.
data
?.
dataList
??
[]);
return
res
.
filter
((
it
)
=>
it
.
children
).
map
((
it
)
=>
it
.
key
);
},
[
data
]);
const
alldata
=
useMemo
(()
=>
{
let
res
=
[];
const
fn
=
(
source
)
=>
{
source
?.
map
((
el
)
=>
{
res
.
push
(
el
);
el
.
children
&&
el
.
children
.
length
>
0
?
fn
(
el
.
children
)
:
""
;
// 子级递归
});
};
fn
(
data
?.
data
?.
dataList
??
[]);
return
res
;
},
[
data
]);
const
treeData
=
useMemo
(()
=>
{
let
res
=
data
?.
data
?.
dataList
??
[];
return
[
...
res
,
// {
// title: "查看实验",
// key: "cksy",
// },
// {
// title: "常见问题",
// key: "cjwt",
// },
];
},
[
data
]);
const
onChange
=
(
e
)
=>
{
const
{
value
}
=
e
.
target
;
const
dataLists
=
getAllList
();
const
newExpandedKeys
=
dataLists
.
map
((
item
)
=>
{
if
(
item
.
title
.
indexOf
(
value
)
>
-
1
)
{
return
getParentKey
(
item
.
key
,
treeData
);
}
return
null
;
})
.
filter
((
item
,
i
,
self
)
=>
item
&&
self
.
indexOf
(
item
)
===
i
);
setsearch
(
value
);
if
(
newExpandedKeys
.
length
>
0
)
{
setexpandall
(
true
);
setAutoExpandParent
(
true
);
}
else
{
setexpandall
(
false
);
setAutoExpandParent
(
false
);
}
onExpand
(
newExpandedKeys
);
};
const
loop
=
(
data
)
=>
data
.
map
((
item
)
=>
{
const
index
=
item
.
title
.
indexOf
(
search
);
const
beforeStr
=
item
.
title
.
substr
(
0
,
index
);
const
afterStr
=
item
.
title
.
substr
(
index
+
search
.
length
);
let
title
=
index
>
-
1
?
(
<
Tooltip
title=
{
item
.
title
}
placement=
"topRight"
>
<
span
style=
{
{
display
:
"block"
,
maxWidth
:
maxWidth
??
88
,
overflow
:
"hidden"
,
textOverflow
:
"ellipsis"
,
whiteSpace
:
"nowrap"
,
marginRight
:
6
,
}
}
>
{
beforeStr
}
<
span
style=
{
{
color
:
"#f50"
}
}
>
{
search
}
</
span
>
{
afterStr
}
</
span
>
</
Tooltip
>
)
:
(
<
Tooltip
title=
{
item
.
title
}
placement=
"topRight"
>
<
span
style=
{
{
display
:
"block"
,
maxWidth
:
maxWidth
??
100
,
overflow
:
"hidden"
,
textOverflow
:
"ellipsis"
,
whiteSpace
:
"nowrap"
,
marginRight
:
6
,
}
}
>
{
item
.
title
}
</
span
>
</
Tooltip
>
);
const
actiontitle
=
(
<
div
className=
"tree-item"
style=
{
{
display
:
"flex"
,
alignItems
:
"center"
,
justifyContent
:
"space-between"
,
padding
:
"4px 6px"
,
}
}
>
<
span
style=
{
{
marginRight
:
6
}
}
>
{
title
}
</
span
>
<
div
className=
"center"
style=
{
{
gap
:
8
}
}
>
{
item
.
key
&&
item
.
key
!=
"00000000"
&&
(
<
Tooltip
title=
"编辑"
onClick=
{
(
e
)
=>
{
e
.
stopPropagation
();
setsavetitle
(
null
);
if
(
true
)
{
setModal
({
visible
:
true
,
closable
:
true
,
title
:
"修改节点名称"
,
okText
:
"修改"
,
cancelText
:
"取消"
,
placeholder
:
item
.
title
,
key
:
item
.
key
,
});
}
}
}
>
<
div
className=
"bgs"
>
<
BorderColorIcon
style=
{
{
color
:
"#1890ff"
,
fontSize
:
14
}
}
/>
</
div
>
</
Tooltip
>
)
}
{
item
.
key
&&
item
.
key
!=
"00000000"
&&
item
.
children
&&
(
<
Tooltip
title=
"新增"
>
<
div
className=
"bgs"
>
<
AddIcon
disabled=
{
false
}
onClick=
{
(
e
)
=>
{
e
.
stopPropagation
();
setsavetitle
(
null
);
if
(
true
)
{
setModal
({
visible
:
true
,
closable
:
true
,
title
:
"新增子结构"
,
okText
:
"新增"
,
cancelText
:
"取消"
,
placeholder
:
item
.
title
,
key
:
item
.
key
,
});
}
}
}
style=
{
{
color
:
`${true ? "green" : ""}`
,
fontSize
:
20
,
}
}
/>
</
div
>
</
Tooltip
>
)
}
{
item
.
key
!=
"0"
&&
(
<
Popconfirm
placement=
"top"
title=
"是否删除该节点?"
okText=
"删除"
cancelText=
"取消"
onConfirm=
{
()
=>
{
doFetch
({
url
:
deleteurl
,
params
:
{
id
:
item
.
key
}
}).
then
(
(
res
)
=>
{
if
(
res
.
code
==
"0000"
)
{
message
.
success
(
"操作成功"
);
refresh
();
}
}
);
}
}
>
<
Tooltip
title=
"删除"
placement=
"bottom"
>
<
div
className=
"bgs"
>
<
HorizontalRuleIcon
style=
{
{
color
:
"red"
,
fontSize
:
16
}
}
/>
</
div
>
</
Tooltip
>
</
Popconfirm
>
)
}
</
div
>
</
div
>
);
if
(
item
.
key
===
"00000000"
)
{
title
=
(
<
div
style=
{
{
display
:
"flex"
,
alignItems
:
"center"
,
justifyContent
:
"space-between"
,
flex
:
1
,
}
}
>
{
title
}
<
Tooltip
title=
{
expandall
?
"收起"
:
"展开"
}
onClick=
{
(
e
)
=>
{
e
.
stopPropagation
();
setexpandall
(
!
expandall
);
onExpand
(
expandall
?
[]
:
allkeys
);
setAutoExpandParent
(
!
expandall
);
}
}
>
{
expandall
?
<
ArrowDownOutlined
/>
:
<
ArrowRightOutlined
/>
}
</
Tooltip
>
</
div
>
);
}
if
(
item
.
children
)
{
return
{
title
:
noaction
?
title
:
actiontitle
,
key
:
item
.
key
,
children
:
loop
(
item
.
children
),
level
:
item
.
level
,
type
:
item
.
type
,
};
}
return
{
title
:
noaction
?
title
:
actiontitle
,
key
:
item
.
key
,
level
:
item
.
level
,
type
:
item
.
type
,
icon
:
item
.
icon
??
null
,
};
});
useEffect
(()
=>
{
setexpandall
(
true
);
onExpand
(
allkeys
);
},
[
allkeys
]);
function
getAllList
()
{
const
dataLists
=
[];
const
generateLists
=
(
data
)
=>
{
for
(
let
i
=
0
;
i
<
data
.
length
;
i
++
)
{
const
node
=
data
[
i
];
const
key
=
node
.
key
;
dataLists
.
push
({
key
,
title
:
node
.
title
,
level
:
node
.
level
});
if
(
node
.
children
)
{
generateLists
(
node
.
children
,
node
.
key
);
}
}
};
generateLists
(
treeData
);
return
dataLists
;
}
return
(
<>
<
Box
flexDirection=
{
"row"
}
display=
{
"flex"
}
justifyContent=
{
"space-between"
}
alignItems=
{
"center"
}
mt=
{
0
}
>
<
Typography
variant=
"h6"
>
课程目录
</
Typography
>
<
IconButton
onClick=
{
()
=>
{
setDrawer
({
open
:
true
});
}
}
>
<
AddIcon
style=
{
{
fontSize
:
20
,
color
:
colors
.
blue
[
600
]
}
}
></
AddIcon
>
</
IconButton
>
<
Modal
{
...
drawer
}
closable=
{
false
}
maskClosable=
{
true
}
title=
"新增章标题"
okText=
"新增"
cancelText=
"取消"
onCancel=
{
()
=>
{
setDrawer
(()
=>
({
item
:
null
,
open
:
false
,
}));
}
}
onOk=
{
()
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
if
(
drawer
?.
item
)
{
doFetch
({
url
:
"/busTrainCatalogue/saveOrUpdateCatalogue"
,
params
:
{
...
params
,
catalogue
:
drawer
.
item
,
},
}).
then
((
res
)
=>
{
if
(
res
.
code
==
"0000"
)
{
message
.
success
(
"操作成功"
);
refresh
();
setDrawer
({
item
:
null
,
open
:
false
,
});
}
});
refresh
();
resolve
();
}
else
{
message
.
warning
(
"请输入修改的名称"
);
reject
();
}
});
}
}
>
<
div
>
<
Input
placeholder=
"请输入章标题"
allowClear
value=
{
drawer
?.
item
}
onChange=
{
(
e
)
=>
{
setDrawer
((
v
)
=>
({
...
v
,
item
:
e
.
target
.
value
,
}));
}
}
></
Input
>
</
div
>
</
Modal
>
</
Box
>
<
div
style=
{
{
...
style
}
}
>
<
Modal
{
...
modal
}
onCancel=
{
()
=>
{
setModal
((
s
)
=>
({
...
s
,
visible
:
false
,
}));
}
}
onOk=
{
()
=>
{
if
(
modal
.
okText
==
"修改"
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
if
(
savetitle
)
{
doFetch
({
url
:
saveurl
,
params
:
{
[
submitKey
]:
savetitle
,
id
:
modal
.
key
,
...
params
,
},
}).
then
((
res
)
=>
{
if
(
res
.
code
==
"0000"
)
{
message
.
success
(
"操作成功"
);
refresh
();
setModal
({
visible
:
false
,
});
}
});
resolve
();
}
else
{
message
.
warning
(
"请输入修改的名称"
);
reject
();
}
});
}
else
{
return
new
Promise
((
resolve
,
reject
)
=>
{
if
(
savetitle
)
{
doFetch
({
url
:
saveurl
,
params
:
{
[
submitKey
]:
savetitle
,
parentId
:
modal
.
key
,
...
params
,
},
}).
then
((
res
)
=>
{
if
(
res
.
code
==
"0000"
)
{
message
.
success
(
"操作成功"
);
refresh
();
setModal
({
visible
:
false
,
});
}
});
resolve
();
}
else
{
message
.
warning
(
"请输入修改的名称"
);
reject
();
}
});
}
}
}
>
{
modal
.
okText
==
"修改"
?
(
<
div
>
<
Input
placeholder=
{
modal
.
placeholder
}
allowClear
value=
{
savetitle
}
onChange=
{
(
e
)
=>
{
setsavetitle
(
e
.
target
.
value
);
}
}
></
Input
>
</
div
>
)
:
(
<
div
>
<
div
style=
{
{
marginBottom
:
15
,
color
:
"#f50"
,
fontSize
:
16
}
}
>
当前结构:
{
modal
.
placeholder
}
</
div
>
<
Input
placeholder=
"子结构"
allowClear
onChange=
{
(
e
)
=>
{
setsavetitle
(
e
.
target
.
value
);
}
}
></
Input
>
</
div
>
)
}
</
Modal
>
<
Search
value=
{
search
}
style=
{
{
margin
:
"16px 0 8px 0"
}
}
placeholder=
"搜索"
onChange=
{
onChange
}
/>
<
Tree
showIcon
showLine
onSelect=
{
(
selectedKeys
,
e
)
=>
{
// //console.log(selectedKeys);
onselected
?.(
selectedKeys
,
e
,
alldata
);
}
}
autoExpandParent=
{
autoExpandParent
}
defaultExpandAll=
{
true
}
expandedKeys=
{
expandedKeys
}
onExpand=
{
(
expandedKeys
,
{
expanded
:
bool
,
node
})
=>
{
onExpand
(
expandedKeys
);
setAutoExpandParent
(
false
);
if
(
!
bool
&&
node
.
key
==
"00000000"
)
{
setexpandall
(
false
);
}
else
{
setexpandall
(
true
);
}
}
}
treeData=
{
loop
(
treeData
??
[])
}
>
{
/* {loop(treeData ? treeData : [])} */
}
</
Tree
>
</
div
>
</>
);
}
export
default
TreeRender
;
src/pages/bustrain/index.jsx
View file @
10337167
...
...
@@ -59,25 +59,17 @@ function Lessons() {
});
};
const
copy
=
(
row
)
=>
{
setdialogprops
({
open
:
true
,
defaultFormValue
:
{
...
row
},
title
:
"复制创建"
,
});
};
const
authorized
=
(
row
)
=>
{
doFetch
({
url
:
"/
busTrainTeacher/queryRelationTeacher
"
,
params
:
{
course
Id
:
row
?.
id
},
url
:
"/
trainStudent/queryRelationStudent
"
,
params
:
{
train
Id
:
row
?.
id
},
}).
then
((
res
)
=>
{
if
(
res
.
code
===
"0000"
)
{
setdialogprops
({
open
:
true
,
maxWidth
:
"xl"
,
defaultFormValue
:
{
...
row
},
teacher
IdList
:
res
?.
data
?.
dataList
,
student
IdList
:
res
?.
data
?.
dataList
,
title
:
"授权"
,
});
}
...
...
@@ -146,9 +138,7 @@ function Lessons() {
dialogprops=
{
dialogprops
}
maxWidth=
{
dialogprops
?.
maxWidth
??
"xs"
}
>
{
dialogprops
?.
title
===
"编辑"
||
dialogprops
?.
title
===
"新增实训"
||
dialogprops
?.
title
===
"复制创建"
?
(
{
dialogprops
?.
title
===
"编辑"
||
dialogprops
?.
title
===
"新增实训"
?
(
<
InitForm
fields=
{
columns
}
defaultFormValue=
{
dialogprops
?.
defaultFormValue
}
...
...
@@ -183,13 +173,6 @@ function Lessons() {
id
:
dialogprops
?.
defaultFormValue
?.
id
,
};
break
;
case
"复制创建"
:
url
=
"/busTrain/copy"
;
postdata
=
{
...
val
,
id
:
dialogprops
?.
defaultFormValue
?.
id
,
};
break
;
default
:
break
;
}
...
...
@@ -202,14 +185,14 @@ function Lessons() {
)
:
(
<
InitForm
defaultFormValue=
{
{
teacherIdList
:
dialogprops
?.
teacher
IdList
,
studentIdList
:
dialogprops
?.
student
IdList
,
}
}
fields=
{
[
{
rowKey
:
"id"
,
rowName
:
"id"
,
valueType
:
"FormSelectList"
,
dataIndex
:
"
teacher
IdList"
,
dataIndex
:
"
student
IdList"
,
colProps
:
{
span
:
24
,
},
...
...
@@ -218,40 +201,48 @@ function Lessons() {
title
:
"账号"
,
key
:
"userAccount"
,
dataIndex
:
"userAccount"
,
readonly
:
tru
e
,
editable
:
fals
e
,
},
{
title
:
"
教师
姓名"
,
title
:
"
学生
姓名"
,
key
:
"name"
,
dataIndex
:
"name"
,
readonly
:
tru
e
,
editable
:
fals
e
,
},
{
title
:
"学校名称"
,
key
:
"school
Name
"
,
key
:
"school
Id
"
,
dataIndex
:
"schoolName"
,
readonly
:
true
,
valueType
:
"select"
,
search
:
false
,
editable
:
false
,
},
{
title
:
"院系名称"
,
key
:
"departmentName"
,
dataIndex
:
"departmentName"
,
readonly
:
true
,
editable
:
false
,
},
{
title
:
"班级名称"
,
key
:
"className"
,
dataIndex
:
"className"
,
editable
:
false
,
},
],
path
:
"/user/
page
"
,
path
:
"/user/
getAllStudentByCurrentTeacherSchool
"
,
params
:
{
type
:
"
2
"
,
type
:
"
3
"
,
},
},
]
}
onFinish=
{
(
val
)
=>
{
const
teacherIdList
=
val
?.
teacher
IdList
?.
map
((
it
)
=>
it
?.
id
);
const
studentIdList
=
val
?.
student
IdList
?.
map
((
it
)
=>
it
?.
id
);
runAsync
({
url
:
"/
busTrainTeacher/relationCourseTeacher
"
,
url
:
"/
trainStudent/relationTrainStudent
"
,
params
:
{
teacher
IdList
,
course
Id
:
dialogprops
?.
defaultFormValue
?.
id
,
student
IdList
,
train
Id
:
dialogprops
?.
defaultFormValue
?.
id
,
},
});
}
}
...
...
@@ -291,7 +282,15 @@ function Lessons() {
{
datalist
?.
loading
&&
!
datalist
?.
data
?
(
PRODUCTS
?.
map
((
product
,
i
)
=>
{
return
(
<
Grid
key=
{
product
.
id
}
item
xs=
{
12
}
sm=
{
6
}
md=
{
4
}
lg=
{
3
}
xl=
{
2.4
}
>
<
Grid
key=
{
product
.
id
}
item
xs=
{
12
}
sm=
{
6
}
md=
{
4
}
lg=
{
3
}
xl=
{
2.4
}
>
<
ShopProductLoadingCard
product=
{
product
}
/>
</
Grid
>
);
...
...
@@ -307,7 +306,6 @@ function Lessons() {
product=
{
product
}
loading=
{
datalist
?.
loading
}
edit=
{
edit
}
copy=
{
copy
}
remove=
{
remove
}
publish=
{
publish
}
authorized=
{
authorized
}
...
...
src/pages/dobustrain/index.jsx
0 → 100644
View file @
10337167
import
AutoTable
from
"@/components/AutoTable"
;
import
DraggableDialog
from
"@/components/DraggableDialog"
;
import
InitForm
from
"@/components/InitForm"
;
import
PremButton
from
"@/components/PremButton"
;
import
TreeRender
from
"@/components/TreeRender/sxtree"
;
import
{
doFetch
}
from
"@/utils/doFetch"
;
import
editorIsNull
from
"@/utils/editorIsNull"
;
import
{
Box
,
Container
,
Grid
,
Link
,
Stack
,
Typography
}
from
"@mui/material"
;
import
{
useParams
}
from
"@umijs/max"
;
import
{
useRequest
}
from
"ahooks"
;
import
{
Badge
,
message
,
Tabs
}
from
"antd"
;
import
{
useEffect
,
useMemo
,
useRef
,
useState
}
from
"react"
;
import
{
history
}
from
"umi"
;
import
"./index.less"
;
function
Dolessons
()
{
const
params
=
useParams
();
const
formRef
=
useRef
(),
cksyactionRef
=
useRef
(),
cjwtactionRef
=
useRef
();
const
[
lessonDetail
,
setlessonDetail
]
=
useState
(
null
),
[
courseContent
,
setCourseContent
]
=
useState
({}),
[
drawer
,
setDrawer
]
=
useState
({
open
:
false
,
}),
[
active
,
setactive
]
=
useState
(
"1"
);
const
{
runAsync
,
loading
}
=
useRequest
(
doFetch
,
{
manual
:
true
,
onSuccess
:
(
res
,
parames
)
=>
{
if
(
res
?.
code
==
"0000"
)
{
handleClose
();
message
.
success
(
"操作成功"
);
if
(
active
===
"2"
)
{
cksyactionRef
?.
current
?.
reload
();
}
else
if
(
active
===
"3"
)
{
cjwtactionRef
?.
current
?.
reload
();
}
}
},
});
useEffect
(()
=>
{
doFetch
({
url
:
"/busTrain/detail"
,
params
:
{
id
:
params
?.
id
}
}).
then
(
(
res
)
=>
{
if
(
res
.
code
===
"0000"
)
{
setlessonDetail
(
res
?.
data
?.
data
);
}
}
);
},
[]);
const
checkCourse
=
(
val
)
=>
{
if
(
val
.
length
)
{
doFetch
({
url
:
"/busTrainCatalogue/getCatalogueContent"
,
params
:
{
id
:
val
[
0
]
},
}).
then
((
res
)
=>
{
setCourseContent
(
res
?.
data
?.
data
);
formRef
.
current
.
setFieldValue
(
"trainContent"
,
res
?.
data
?.
data
?.
trainContent
);
});
}
};
const
edit
=
(
text
,
row
,
_
,
action
)
=>
{
return
(
<
PremButton
btn=
{
{
size
:
"small"
,
variant
:
"text"
,
onClick
:
()
=>
{
setDrawer
((
v
)
=>
({
open
:
true
,
defaultFormValue
:
{
...
row
},
title
:
"编辑"
,
}));
},
}
}
>
编辑
</
PremButton
>
);
};
const
remove
=
(
text
,
row
,
_
,
action
)
=>
{
return
(
<
PremButton
pop=
{
{
title
:
"是否删除该实验?"
,
okText
:
"确认"
,
cancelText
:
"取消"
,
onConfirm
:
async
()
=>
{
await
runAsync
({
url
:
"/busTrainExperiment/remove"
,
params
:
{
id
:
row
?.
id
},
});
},
}
}
btn=
{
{
size
:
"small"
,
color
:
"error"
,
}
}
>
删除
</
PremButton
>
);
};
const
removeq
=
(
text
,
row
,
_
,
action
)
=>
{
return
(
<
PremButton
pop=
{
{
title
:
"是否删除该实验?"
,
okText
:
"确认"
,
cancelText
:
"取消"
,
onConfirm
:
async
()
=>
{
await
runAsync
({
url
:
"/courseQuestion/delete"
,
params
:
{
id
:
row
?.
id
},
});
},
}
}
btn=
{
{
size
:
"small"
,
color
:
"error"
,
}
}
>
删除
</
PremButton
>
);
};
const
questionColumns
=
useMemo
(()
=>
{
let
col
=
[
{
title
:
"问题内容"
,
dataIndex
:
"question"
,
key
:
"question"
,
width
:
400
,
formItemProps
:
{
rules
:
[{
required
:
true
,
message
:
"此项为必填项"
}]
},
},
{
title
:
"参考答案"
,
dataIndex
:
"answer"
,
key
:
"answer"
,
formItemProps
:
{
rules
:
[{
required
:
true
,
message
:
"此项为必填项"
}]
},
},
];
return
col
;
},
[]);
const
experimentColumns
=
useMemo
(()
=>
{
let
col
=
[
{
title
:
"实验名称"
,
dataIndex
:
"experimentName"
,
key
:
"experimentName"
,
formItemProps
:
{
rules
:
[{
required
:
true
,
message
:
"此项为必填项"
}]
},
render
:
(
_
,
row
)
=>
{
return
(
<
Link
underline=
"hover"
href=
{
row
?.
url
}
target=
"_blank"
rel=
"noopener"
>
{
row
?.
experimentName
}
</
Link
>
);
},
search
:
false
,
},
{
title
:
"考试时间(分钟)"
,
search
:
false
,
dataIndex
:
"testTime"
,
key
:
"testTime"
,
formItemProps
:
{
rules
:
[{
required
:
true
,
message
:
"此项为必填项"
}]
},
},
{
title
:
"权重(%)"
,
search
:
false
,
dataIndex
:
"weight"
,
key
:
"weight"
,
formItemProps
:
{
rules
:
[{
required
:
true
,
message
:
"此项为必填项"
}]
},
},
{
search
:
false
,
title
:
"创建人"
,
dataIndex
:
"updateUserName"
,
key
:
"updateUserName"
,
formItemProps
:
{
rules
:
[{
required
:
true
,
message
:
"此项为必填项"
}]
},
},
{
title
:
"创建时间"
,
dataIndex
:
"updateTime"
,
search
:
false
,
key
:
"updateTime"
,
formItemProps
:
{
rules
:
[{
required
:
true
,
message
:
"此项为必填项"
}]
},
},
{
title
:
"截止时间"
,
dataIndex
:
"deadline"
,
search
:
false
,
key
:
"deadline"
,
formItemProps
:
{
rules
:
[{
required
:
true
,
message
:
"此项为必填项"
}]
},
},
{
title
:
"实验完成率"
,
dataIndex
:
"finishPer"
,
search
:
false
,
key
:
"finishPer"
,
formItemProps
:
{
rules
:
[{
required
:
true
,
message
:
"此项为必填项"
}]
},
},
];
return
col
;
},
[]);
const
items
=
[
{
key
:
"1"
,
label
:
`课程目录`
,
children
:
(
<
Grid
container
spacing=
{
2
}
>
<
Grid
item
width=
{
340
}
>
<
Box
boxShadow=
{
"0 0 18px #f0f0f0"
}
borderRadius=
{
2
}
padding=
{
2
}
>
<
TreeRender
onselected=
{
checkCourse
}
maxWidth=
{
170
}
url=
"/busTrainCatalogue/queryCatalogueTree"
saveurl=
"/busTrainCatalogue/saveOrUpdateCatalogue"
deleteurl=
"/busTrainCatalogue/deleteCatalogue"
submitKey=
"catalogue"
params=
{
{
trainId
:
params
?.
id
,
}
}
/>
</
Box
>
</
Grid
>
<
Grid
item
flex=
{
1
}
>
<
Box
boxShadow=
{
"0 0 18px #f0f0f0"
}
borderRadius=
{
2
}
padding=
{
2
}
>
<
InitForm
formRef=
{
formRef
}
fields=
{
[
{
key
:
"trainContent"
,
dataIndex
:
"trainContent"
,
valueType
:
"Editor"
,
colProps
:
{
span
:
24
,
},
},
]
}
onFinish=
{
(
val
)
=>
{
const
data
=
{
...
val
};
if
(
editorIsNull
(
data
?.
trainContent
))
{
return
message
.
warning
(
"备课内容不能为空!"
,
2
);
}
doFetch
({
url
:
"/busTrainCatalogue/saveCatalogueContent"
,
params
:
{
id
:
courseContent
?.
id
,
trainContent
:
data
?.
trainContent
,
},
}).
then
((
res
)
=>
{
if
(
res
.
code
===
"0000"
)
{
message
.
success
(
"操作成功!"
);
}
});
}
}
/>
</
Box
>
</
Grid
>
</
Grid
>
),
},
{
key
:
"2"
,
label
:
(
<
Badge
count=
{
lessonDetail
?.
experimentNum
}
size=
"small"
offset=
{
[
6
,
0
]
}
>
查看实验
</
Badge
>
),
children
:
(
<
Box
boxShadow=
{
"0 0 18px #f0f0f0"
}
borderRadius=
{
2
}
>
<
AutoTable
rerendered=
{
false
}
actionRef=
{
cksyactionRef
}
columns=
{
[
...
experimentColumns
,
{
title
:
"操作"
,
valueType
:
"option"
,
width
:
180
,
render
:
(
text
,
row
,
_
,
action
)
=>
[
edit
(
text
,
row
,
_
,
action
),
remove
(
text
,
row
,
_
,
action
),
],
},
]
}
path=
"/busTrainExperiment/page"
extraparams=
{
{
trainId
:
params
?.
id
,
}
}
/>
</
Box
>
),
},
{
key
:
"3"
,
label
:
"常见问题"
,
children
:
(
<
Box
boxShadow=
{
"0 0 18px #f0f0f0"
}
borderRadius=
{
2
}
>
<
AutoTable
rerendered=
{
false
}
actionRef=
{
cjwtactionRef
}
columns=
{
[
...
questionColumns
,
{
title
:
"操作"
,
valueType
:
"option"
,
width
:
180
,
render
:
(
text
,
row
,
_
,
action
)
=>
[
edit
(
text
,
row
,
_
,
action
),
removeq
(
text
,
row
,
_
,
action
),
],
},
]
}
path=
"/courseQuestion/page"
extraparams=
{
{
trainId
:
params
?.
id
,
}
}
/>
</
Box
>
),
},
];
const
addHandel
=
(
val
)
=>
{
if
(
active
===
"1"
)
{
// 预览
}
else
if
(
active
===
"2"
)
{
// 添加实验
setDrawer
({
open
:
true
,
title
:
"添加实验"
});
}
else
{
// 添加问题
setDrawer
({
open
:
true
,
title
:
"添加问题"
});
}
};
const
handleClose
=
()
=>
{
setDrawer
((
s
)
=>
({
...
s
,
open
:
false
,
}));
};
return
(
<
Container
maxWidth=
{
false
}
>
<
DraggableDialog
handleClose=
{
handleClose
}
dialogprops=
{
drawer
}
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
},
},
formItemProps
:
{
rules
:
[
{
required
:
true
,
message
:
"此项为必填项"
,
},
],
},
},
{
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
:
"此项为必填项"
,
},
],
},
},
]
}
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
,
});
});
}
}
}
></
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
:
"/courseQuestion/saveOrUpdate"
,
params
:
postdata
,
});
}
}
></
InitForm
>
)
}
</
DraggableDialog
>
<
Box
display=
{
"flex"
}
justifyContent=
{
"space-between"
}
alignItems=
{
"center"
}
sx=
{
{
mb
:
2.5
}
}
mt=
{
0
}
>
<
Typography
variant=
"h5"
>
{
lessonDetail
?.
trainName
??
"暂无名称"
}
</
Typography
>
<
Stack
spacing=
{
2
}
direction=
"row"
>
<
PremButton
btn=
{
{
variant
:
"outlined"
,
onClick
:
(
e
)
=>
{
e
.
stopPropagation
();
history
.
back
();
},
}
}
>
返回
</
PremButton
>
<
PremButton
btn=
{
{
variant
:
"contained"
,
onClick
:
addHandel
,
}
}
>
{
active
===
"1"
?
"预览"
:
active
===
"2"
?
"添加实验"
:
"添加问题"
}
</
PremButton
>
</
Stack
>
</
Box
>
<
Box
>
<
Tabs
activeKey=
{
active
}
onChange=
{
setactive
}
items=
{
items
}
tabPosition=
"top"
animated=
{
true
}
/>
</
Box
>
</
Container
>
);
}
export
default
Dolessons
;
src/pages/dobustrain/index.less
0 → 100644
View file @
10337167
.white {
.ant-pro-card {
background-color: #f6f6f6 !important;
}
.ant-table-tbody,td {
background-color: #f9f9f9 !important;
}
}
.ant-tree{
background-color: transparent !important;
}
\ No newline at end of file
src/pages/lessons/index.jsx
View file @
10337167
...
...
@@ -7,8 +7,11 @@ 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
,
message
}
from
"antd"
;
import
{
Empty
,
Input
,
message
}
from
"antd"
;
import
{
useMemo
,
useState
}
from
"react"
;
import
"./index.less"
;
...
...
@@ -19,7 +22,7 @@ function Lessons() {
const
[
params
,
setparams
]
=
useState
({
courseName
:
""
,
status
:
null
,
type
:
null
,
type
List
:
[
"1"
,
"2"
,
"3"
]
,
});
const
handleClose
=
()
=>
{
...
...
@@ -47,6 +50,7 @@ function Lessons() {
},
{
debounceWait
:
400
,
refreshDeps
:[
params
]
}
);
...
...
@@ -184,25 +188,25 @@ function Lessons() {
title
:
"账号"
,
key
:
"userAccount"
,
dataIndex
:
"userAccount"
,
readonly
:
tru
e
,
editable
:
fals
e
,
},
{
title
:
"教师姓名"
,
key
:
"name"
,
dataIndex
:
"name"
,
readonly
:
tru
e
,
editable
:
fals
e
,
},
{
title
:
"学校名称"
,
key
:
"schoolName"
,
dataIndex
:
"schoolName"
,
readonly
:
tru
e
,
editable
:
fals
e
,
},
{
title
:
"院系名称"
,
key
:
"departmentName"
,
dataIndex
:
"departmentName"
,
readonly
:
tru
e
,
editable
:
fals
e
,
},
],
path
:
"/user/page"
,
...
...
@@ -232,8 +236,91 @@ function Lessons() {
mt=
{
0
}
>
<
Typography
variant=
"h5"
>
课程管理
</
Typography
>
<
Stack
spacing=
{
2
}
direction=
"row"
>
<
Stack
spacing=
{
2
}
direction=
"row"
flex=
{
1
}
justifyContent=
{
"flex-end"
}
>
<
FormControlLabel
control=
{
<
Checkbox
checked=
{
params
?.
typeList
?.
length
===
3
}
indeterminate=
{
params
?.
typeList
?.
length
>
0
&&
params
?.
typeList
?.
length
<
3
}
/>
}
label=
"全部"
onChange=
{
(
e
)
=>
{
setparams
((
s
)
=>
{
let
news
=
[];
if
(
e
.
target
.
checked
)
{
news
=
[
"1"
,
"2"
,
"3"
];
}
return
{
...
s
,
typeList
:
news
,
};
});
}
}
/>
<
FormGroup
row
value=
{
params
?.
typeList
??
[]
}
onChange=
{
(
e
)
=>
{
let
val
=
e
.
target
.
value
;
setparams
((
s
)
=>
{
let
news
=
[...
s
?.
typeList
];
if
(
news
.
includes
(
val
))
{
news
=
news
.
filter
((
it
)
=>
it
!==
val
);
}
else
{
news
=
[...
news
,
val
];
}
console
.
log
(
news
);
return
{
...
s
,
typeList
:
news
,
};
});
}
}
>
<
FormControlLabel
control=
{
<
Checkbox
checked=
{
params
?.
typeList
?.
includes
(
"1"
)
}
color=
{
"warning"
}
/>
}
label=
"待发布"
value=
{
1
}
/>
<
FormControlLabel
control=
{
<
Checkbox
checked=
{
params
?.
typeList
?.
includes
(
"2"
)
}
color=
{
"info"
}
/>
}
label=
"已发布"
value=
{
2
}
/>
<
FormControlLabel
control=
{
<
Checkbox
checked=
{
params
?.
typeList
?.
includes
(
"3"
)
}
color=
{
"default"
}
/>
}
label=
"已关闭"
value=
{
3
}
/>
</
FormGroup
>
<
Input
placeholder=
"请输入课程名称"
style=
{
{
width
:
200
}
}
value=
{
params
?.
courseName
}
onChange=
{
(
e
)
=>
{
setparams
(
s
=>
({
...
s
,
courseName
:
e
.
target
.
value
}))
}
}
></
Input
>
<
ImportExcel
></
ImportExcel
>
<
PremButton
btn=
{
{
variant
:
"contained"
,
...
...
@@ -257,7 +344,15 @@ function Lessons() {
{
datalist
?.
loading
&&
!
datalist
?.
data
?
(
PRODUCTS
?.
map
((
product
,
i
)
=>
{
return
(
<
Grid
key=
{
product
.
id
}
item
xs=
{
12
}
sm=
{
6
}
md=
{
4
}
lg=
{
3
}
xl=
{
2.4
}
>
<
Grid
key=
{
product
.
id
}
item
xs=
{
12
}
sm=
{
6
}
md=
{
4
}
lg=
{
3
}
xl=
{
2.4
}
>
<
ShopProductLoadingCard
product=
{
product
}
/>
</
Grid
>
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment