Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
tea-resources-web
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
张伯涛
tea-resources-web
Commits
b47b1bca
Commit
b47b1bca
authored
Apr 15, 2024
by
ZhangKai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update: 修改单位开课导入
parent
0771585c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
38 deletions
+30
-38
teaTrialCourse.js
src/api/try/teaTrialCourse.js
+16
-1
index.vue
src/views/courseInformation/classManagement/index.vue
+14
-37
No files found.
src/api/try/teaTrialCourse.js
View file @
b47b1bca
...
@@ -84,7 +84,7 @@ export function batchAddTeaTrialCourse(data) {
...
@@ -84,7 +84,7 @@ export function batchAddTeaTrialCourse(data) {
})
})
}
}
//
8.下载
导入模板
//
下载开课
导入模板
export
function
importTemplateTrialCourse
(
params
)
{
export
function
importTemplateTrialCourse
(
params
)
{
return
request
({
return
request
({
url
:
'/teatrialcourse/importTemplate'
,
url
:
'/teatrialcourse/importTemplate'
,
...
@@ -93,3 +93,18 @@ export function importTemplateTrialCourse(params) {
...
@@ -93,3 +93,18 @@ export function importTemplateTrialCourse(params) {
params
params
})
})
}
}
// 导入开课信息
export
function
importExcel
(
data
)
{
return
request
({
url
:
'/teatrialcourse/importDictData'
,
method
:
'post'
,
headers
:
{
'Content-Type'
:
'multipart/form-data'
},
transformRequest
:
[(
data
)
=>
{
return
data
}],
data
})
}
src/views/courseInformation/classManagement/index.vue
View file @
b47b1bca
...
@@ -580,6 +580,7 @@
...
@@ -580,6 +580,7 @@
<!-- 单位导入对话框 -->
<!-- 单位导入对话框 -->
<el-dialog
:title=
"upload.title"
:visible
.
sync=
"upload.open"
width=
"400px"
append-to-body
>
<el-dialog
:title=
"upload.title"
:visible
.
sync=
"upload.open"
width=
"400px"
append-to-body
>
<el-upload
<el-upload
ref=
"upload"
accept=
".xlsx, .xls"
accept=
".xlsx, .xls"
:headers=
"upload.headers"
:headers=
"upload.headers"
:action=
"upload.url + '?updateSupport=' + upload.updateSupport"
:action=
"upload.url + '?updateSupport=' + upload.updateSupport"
...
@@ -600,7 +601,6 @@
...
@@ -600,7 +601,6 @@
<em>
点击上传
</em>
<em>
点击上传
</em>
</div>
</div>
<div
slot=
"tip"
class=
"el-upload__tip"
>
<div
slot=
"tip"
class=
"el-upload__tip"
>
<el-checkbox
v-model=
"upload.updateSupport"
/>
是否更新已经存在的数据
<el-link
type=
"info"
style=
"font-size:12px"
@
click=
"importTemplate"
>
下载模板
</el-link>
<el-link
type=
"info"
style=
"font-size:12px"
@
click=
"importTemplate"
>
下载模板
</el-link>
</div>
</div>
<div
slot=
"tip"
class=
"el-upload__tip"
style=
"color:red"
>
提示:仅允许导入“xls”或“xlsx”格式文件!
</div>
<div
slot=
"tip"
class=
"el-upload__tip"
style=
"color:red"
>
提示:仅允许导入“xls”或“xlsx”格式文件!
</div>
...
@@ -623,11 +623,11 @@ import {
...
@@ -623,11 +623,11 @@ import {
batchAddTeaTrialCourse
,
batchAddTeaTrialCourse
,
delTeaTrialCourse
,
importTemplateTrialCourse
,
listALLTeaTrialCourse
,
delTeaTrialCourse
,
importTemplateTrialCourse
,
listALLTeaTrialCourse
,
listTeaTrialCourse
,
listTeaTrialCourse
,
updateTeaTrialCourse
updateTeaTrialCourse
,
importExcel
}
from
'@/api/try/teaTrialCourse'
}
from
'@/api/try/teaTrialCourse'
import
dict
from
'@/views/system/dict/index.vue'
import
dict
from
'@/views/system/dict/index.vue'
import
{
getDict
}
from
'@/api/system/dict/data'
import
{
getDict
}
from
'@/api/system/dict/data'
import
{
importExcel
,
uploadFalseFile
}
from
'@/api/system/user'
import
{
getToken
}
from
'@/utils/auth'
import
{
getToken
}
from
'@/utils/auth'
export
default
{
export
default
{
name
:
'Role'
,
name
:
'Role'
,
...
@@ -644,14 +644,13 @@ export default {
...
@@ -644,14 +644,13 @@ export default {
title
:
''
,
title
:
''
,
// 是否禁用上传
// 是否禁用上传
isUploading
:
false
,
isUploading
:
false
,
// 是否更新已经存在的用户数据
updateSupport
:
0
,
// 设置上传的请求头部
// 设置上传的请求头部
headers
:
{
Authorization
:
'Bearer '
+
getToken
()
},
headers
:
{
Authorization
:
'Bearer '
+
getToken
()
},
// 上传的地址
// 上传的地址
url
:
process
.
env
.
VUE_APP_BASE_API
+
'/
system/user/importExcel
'
url
:
process
.
env
.
VUE_APP_BASE_API
+
'/
teatrialcourse/importDictData
'
},
},
// 文件上传加载状态
importLoading
:
false
,
// 修改页面默认打开的树壮菜单
// 修改页面默认打开的树壮菜单
updateMenu
:
[],
updateMenu
:
[],
unitDisplay
:
false
,
unitDisplay
:
false
,
...
@@ -1140,7 +1139,7 @@ export default {
...
@@ -1140,7 +1139,7 @@ export default {
},
},
/** 导入按钮操作 */
/** 导入按钮操作 */
handleImport
()
{
handleImport
()
{
this
.
upload
.
title
=
'
用户
导入'
this
.
upload
.
title
=
'
开课
导入'
this
.
upload
.
open
=
true
this
.
upload
.
open
=
true
},
},
/** 下载模板操作 */
/** 下载模板操作 */
...
@@ -1184,36 +1183,14 @@ export default {
...
@@ -1184,36 +1183,14 @@ export default {
formData
.
append
(
'file'
,
this
.
fileList
)
formData
.
append
(
'file'
,
this
.
fileList
)
importExcel
(
formData
).
then
(
res
=>
{
importExcel
(
formData
).
then
(
res
=>
{
if
(
res
.
code
===
200
)
{
if
(
res
.
code
===
200
)
{
if
(
res
.
data
.
filename
===
null
)
{
this
.
$message
.
success
(
res
.
data
)
this
.
$message
.
success
(
'导入成功'
)
this
.
fileList
=
[]
this
.
fileList
=
[]
// 导入成功后关闭弹出框
// 导入成功后关闭弹出框
this
.
upload
.
open
=
false
this
.
importLoading
=
false
// 导入成功后刷新页面
this
.
upload
.
open
=
false
this
.
getList
()
// 导入成功后刷新页面
this
.
getList
()
}
else
{
uploadFalseFile
({
fileName
:
res
.
data
.
filename
}).
then
(
res
=>
{
const
blob
=
new
Blob
([
res
])
const
downloadElement
=
document
.
createElement
(
'a'
)
const
href
=
window
.
URL
.
createObjectURL
(
blob
)
// 创建下载的链接
downloadElement
.
href
=
href
downloadElement
.
download
=
'模板错误提示'
+
'.txt'
// 下载后文件名
document
.
body
.
appendChild
(
downloadElement
)
downloadElement
.
click
()
// 点击下载
document
.
body
.
removeChild
(
downloadElement
)
// 下载完成移除元素
window
.
URL
.
revokeObjectURL
(
href
)
// 释放掉blob对象
this
.
importLoading
=
false
})
}
this
.
importLoading
=
false
}
else
if
(
res
.
code
===
41020
)
{
this
.
$message
.
info
(
'上传超时,请重新上传'
)
this
.
importLoading
=
false
}
else
{
this
.
$message
.
error
(
res
.
message
)
this
.
importLoading
=
false
}
}
this
.
importLoading
=
false
}).
catch
(
err
=>
{
}).
catch
(
err
=>
{
this
.
$message
.
success
(
err
.
message
)
this
.
$message
.
success
(
err
.
message
)
this
.
importLoading
=
false
this
.
importLoading
=
false
...
...
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