Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
center-resource
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
center-resource
Commits
b1cf0392
提交
b1cf0392
authored
10月 16, 2024
作者:
王鹏飞
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chore: 班级新增批量导入
上级
7949d468
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
101 行增加
和
7 行删除
+101
-7
api.ts
src/modules/admin/class/api.ts
+6
-0
ImportClass.vue
src/modules/admin/class/components/ImportClass.vue
+78
-0
List.vue
src/modules/admin/class/views/List.vue
+16
-7
ImportStudent.vue
src/modules/admin/student/components/ImportStudent.vue
+1
-0
没有找到文件。
src/modules/admin/class/api.ts
浏览文件 @
b1cf0392
...
@@ -70,3 +70,9 @@ export function relationClassSem(data?: { class_id: string; semesters_id: string
...
@@ -70,3 +70,9 @@ export function relationClassSem(data?: { class_id: string; semesters_id: string
return
httpRequest
.
post
(
'/api/resource/v1/learning/class/add-semesters'
,
data
)
return
httpRequest
.
post
(
'/api/resource/v1/learning/class/add-semesters'
,
data
)
}
}
// // 导入学生
export
function
importClass
(
data
:
{
file
:
any
})
{
return
httpRequest
.
post
(
'/api/resource/v1/learning/class/import'
,
data
,
{
headers
:
{
'Content-Type'
:
'multipart/form-data'
}
})
}
src/modules/admin/class/components/ImportClass.vue
0 → 100644
浏览文件 @
b1cf0392
<
script
lang=
"ts"
setup
>
import
{
ElMessage
}
from
'element-plus'
import
{
UploadFilled
}
from
'@element-plus/icons-vue'
import
{
splitStrLast
}
from
'@/utils/util'
import
{
importClass
}
from
'../api'
const
emit
=
defineEmits
<
Emits
>
()
const
upload
=
ref
()
const
fileList
=
ref
([])
// 文件列表
defineProps
({
isShowImportDialog
:
{
type
:
Boolean
}
})
interface
Emits
{
(
e
:
'update:isShowImportDialog'
,
isShowImportDialog
:
boolean
):
void
(
e
:
'create'
):
void
}
// 取消
const
handleCancel
=
()
=>
{
emit
(
'update:isShowImportDialog'
,
false
)
}
const
beforeUpload
=
(
file
:
any
)
=>
{
const
suffix
=
splitStrLast
(
file
.
name
,
'.'
)
if
(
!
[
'xlsx'
,
'xls'
].
includes
(
suffix
))
{
ElMessage
.
warning
(
'只能上传excel文件'
)
return
false
}
else
{
return
true
}
}
const
fetchFileUpload
=
(
option
:
any
)
=>
{
return
new
Promise
(()
=>
{
importClass
({
file
:
option
.
file
}).
then
(()
=>
{
ElMessage
.
success
(
'导入数据成功'
)
emit
(
'update:isShowImportDialog'
,
false
)
emit
(
'create'
)
})
})
}
const
handleSubmitUpload
=
()
=>
{
upload
.
value
.
submit
()
}
</
script
>
<
template
>
<el-dialog
:model-value=
"isShowImportDialog"
draggable
:before-close=
"handleCancel"
title=
"批量导入班级"
width=
"30%"
>
<el-upload
style=
"text-align: center"
class=
"file-import"
ref=
"upload"
action=
"#"
accept=
".xls,.xlsx"
drag
:auto-upload=
"false"
:file-list=
"fileList"
:limit=
"1"
:before-upload=
"beforeUpload"
:http-request=
"fetchFileUpload"
>
<el-icon
class=
"el-icon--upload"
><upload-filled
/></el-icon>
<div
class=
"el-upload__text"
>
将文件拖至此处,点击上传
</div>
</el-upload>
<div
style=
"margin-bottom: 10px; text-align: center"
>
导入模板下载:
<a
href=
"https://webapp-pub.ezijing.com/center_resource/班级导入模板.xlsx"
download=
"班级模板"
><el-link
type=
"primary"
>
班级模板.xlsx
</el-link></a
>
</div>
<template
#
footer
>
<span>
<el-button
@
click=
"handleCancel"
>
取消
</el-button>
<el-button
type=
"primary"
@
click=
"handleSubmitUpload"
>
确认
</el-button>
</span>
</
template
>
</el-dialog>
</template>
src/modules/admin/class/views/List.vue
浏览文件 @
b1cf0392
...
@@ -7,6 +7,8 @@ import ClassStudents from '../components/ClassStudents.vue'
...
@@ -7,6 +7,8 @@ import ClassStudents from '../components/ClassStudents.vue'
import
RelatedTerm
from
'../components/RelatedTerm.vue'
import
RelatedTerm
from
'../components/RelatedTerm.vue'
import
{
useUserStore
}
from
'@/stores/user'
import
{
useUserStore
}
from
'@/stores/user'
import
{
getClassList
,
updateClass
}
from
'../api'
import
{
getClassList
,
updateClass
}
from
'../api'
import
ImportClass
from
'../components/ImportClass.vue'
const
departmentList
:
any
=
useProjectList
(
''
,
'79806610719731712'
).
departmentList
const
departmentList
:
any
=
useProjectList
(
''
,
'79806610719731712'
).
departmentList
// 判断当前用户是不是超级管理员
// 判断当前用户是不是超级管理员
...
@@ -73,13 +75,18 @@ const handleChangeStatus = (row: any) => {
...
@@ -73,13 +75,18 @@ const handleChangeStatus = (row: any) => {
const
params
:
any
=
Object
.
assign
({},
row
)
const
params
:
any
=
Object
.
assign
({},
row
)
updateClass
(
params
).
then
(()
=>
{
updateClass
(
params
).
then
(()
=>
{
ElMessage
.
success
(
'更新班级成功'
)
ElMessage
.
success
(
'更新班级成功'
)
handle
F
resh
()
handle
Ref
resh
()
})
})
}
}
}
}
const
handle
F
resh
=
()
=>
{
const
handle
Ref
resh
=
()
=>
{
appList
.
value
.
refetch
()
appList
.
value
.
refetch
()
}
}
const
isShowImportDialog
=
ref
(
false
)
// 批量导入
const
handleImport
=
()
=>
{
isShowImportDialog
.
value
=
true
}
</
script
>
</
script
>
<
template
>
<
template
>
...
@@ -88,9 +95,11 @@ const handleFresh = () => {
...
@@ -88,9 +95,11 @@ const handleFresh = () => {
<el-button
type=
"primary"
round
@
click=
"handleAddClass"
v-permission=
"'v1-learning-class-create'"
<el-button
type=
"primary"
round
@
click=
"handleAddClass"
v-permission=
"'v1-learning-class-create'"
>
新增班级
</el-button
>
新增班级
</el-button
>
>
<el-button
type=
"primary"
round
@
click=
"handleImport"
>
批量导入
</el-button>
<template
v-if=
"isAdmin"
#
filter-department=
"
{ params }">
<template
v-if=
"isAdmin"
#
filter-department=
"
{ params }">
<div
class=
"name"
style=
"font-size: 14px; color: #606266; padding-right: 12px"
>
所属部门/学校:
</div>
<div
class=
"name"
style=
"font-size: 14px; color: #606266; padding-right: 12px"
>
所属部门/学校:
</div>
<el-select
@
change=
"handle
F
resh"
clearable
v-model=
"params.organ_id"
placeholder=
"请选择所属部门/学校"
>
<el-select
@
change=
"handle
Ref
resh"
clearable
v-model=
"params.organ_id"
placeholder=
"请选择所属部门/学校"
>
<el-option
v-for=
"item in departmentList"
:key=
"item.id"
:label=
"item.name"
:value=
"item.id"
/>
<el-option
v-for=
"item in departmentList"
:key=
"item.id"
:label=
"item.name"
:value=
"item.id"
/>
</el-select>
</el-select>
</
template
>
</
template
>
...
@@ -103,8 +112,7 @@ const handleFresh = () => {
...
@@ -103,8 +112,7 @@ const handleFresh = () => {
inline-prompt
inline-prompt
style=
"--el-switch-on-color: #aa1941"
style=
"--el-switch-on-color: #aa1941"
@
change=
"handleChangeStatus(row)"
@
change=
"handleChangeStatus(row)"
:disabled=
"!isAdmin"
:disabled=
"!isAdmin"
></el-switch>
></el-switch>
</
template
>
</
template
>
<
template
#
table-operate=
"{ row }"
>
<
template
#
table-operate=
"{ row }"
>
<el-space>
<el-space>
...
@@ -130,8 +138,9 @@ const handleFresh = () => {
...
@@ -130,8 +138,9 @@ const handleFresh = () => {
:title=
"title"
:title=
"title"
:id=
"id"
:id=
"id"
:isEdit=
"isEdit"
:isEdit=
"isEdit"
@
create=
"handleFresh"
@
create=
"handleRefresh"
/>
/>
<ClassStudents
v-model:isShowClassStuDialog=
"isShowClassStuDialog"
v-if=
"isShowClassStuDialog === true"
:id=
"id"
/>
<ClassStudents
v-model:isShowClassStuDialog=
"isShowClassStuDialog"
v-if=
"isShowClassStuDialog === true"
:id=
"id"
/>
<RelatedTerm
v-model:isRelatingDialog=
"isRelatingDialog"
v-if=
"isRelatingDialog === true"
:id=
"id"
/>
<RelatedTerm
v-model:isRelatingDialog=
"isRelatingDialog"
v-if=
"isRelatingDialog === true"
:id=
"id"
/>
<!-- 导入学生 -->
<ImportClass
v-if=
"isShowImportDialog"
v-model:isShowImportDialog=
"isShowImportDialog"
@
create=
"handleRefresh"
/>
</template>
</template>
src/modules/admin/student/components/ImportStudent.vue
浏览文件 @
b1cf0392
<
script
lang=
"ts"
setup
>
<
script
lang=
"ts"
setup
>
import
{
ElMessage
}
from
'element-plus'
import
{
ElMessage
}
from
'element-plus'
import
{
UploadFilled
}
from
'@element-plus/icons-vue'
import
{
splitStrLast
}
from
'@/utils/util'
import
{
splitStrLast
}
from
'@/utils/util'
import
{
importStudent
}
from
'../api'
import
{
importStudent
}
from
'../api'
const
emit
=
defineEmits
<
Emits
>
()
const
emit
=
defineEmits
<
Emits
>
()
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论