Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
web-template
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
张伯涛
web-template
Commits
733ca381
Commit
733ca381
authored
Jan 11, 2021
by
shen_yan_pu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完善
parent
cc0c3990
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
14 deletions
+67
-14
role.js
src/api/system/role.js
+2
-1
index.vue
src/views/system/role/index.vue
+17
-10
index.vue
src/views/system/user/index.vue
+48
-3
No files found.
src/api/system/role.js
View file @
733ca381
...
...
@@ -83,6 +83,7 @@ export function exportRole(query) {
return
request
({
url
:
'/system/role/export'
,
method
:
'get'
,
params
:
query
params
:
query
,
responseType
:
'blob'
})
}
src/views/system/role/index.vue
View file @
733ca381
...
...
@@ -637,17 +637,24 @@ export default {
/** 导出按钮操作 */
handleExport
()
{
const
queryParams
=
this
.
queryParams
exportRole
(
queryParams
).
then
(
response
=>
{
this
.
download
(
response
.
msg
)
}).
catch
(
function
()
{
this
.
$confirm
(
'是否确认导出所有用户信息?'
,
'警告'
,
{
confirmButtonText
:
'确定'
,
cancelButtonText
:
'取消'
,
type
:
'warning'
}).
then
(
function
()
{
return
exportRole
(
queryParams
).
then
(
response
=>
{
const
blob
=
new
Blob
([
response
])
const
downloadElement
=
document
.
createElement
(
'a'
)
const
href
=
window
.
URL
.
createObjectURL
(
blob
)
// 创建下载的链接
downloadElement
.
href
=
href
downloadElement
.
download
=
'角色信息'
+
'.xls'
// 下载后文件名
document
.
body
.
appendChild
(
downloadElement
)
downloadElement
.
click
()
// 点击下载
document
.
body
.
removeChild
(
downloadElement
)
// 下载完成移除元素
window
.
URL
.
revokeObjectURL
(
href
)
// 释放掉blob对象
// this.download(response.msg);
})
})
// this.$confirm('是否确认导出所有角色数据项?', '提示', {
// confirmButtonText: '确定',
// cancelButtonText: '取消',
// type: 'warning'
// }).then(function() {
// return
// }
}
}
}
...
...
src/views/system/user/index.vue
View file @
733ca381
...
...
@@ -317,7 +317,7 @@
</el-upload>
<div
slot=
"footer"
class=
"dialog-footer"
>
<el-button
@
click=
"upload.open = false"
>
取 消
</el-button>
<el-button
type=
"primary"
@
click=
"submitFileForm"
>
确 定
</el-button>
<el-button
:loading=
"importLoading"
type=
"primary"
@
click=
"submitFileForm"
>
确 定
</el-button>
</div>
</el-dialog>
<el-dialog
...
...
@@ -366,6 +366,8 @@ import {
exportUser
,
resetUserPwd
,
changeUserStatus
,
importExcel
,
uploadFalseFile
,
importTemplate
// userLoginManage
}
from
'@/api/system/user'
...
...
@@ -446,6 +448,7 @@ export default {
deptName
:
undefined
,
// 默认密码
initPassword
:
undefined
,
importLoading
:
false
,
// // 时间范围
// dateRange: ['', ''],
// 状态数据字典
...
...
@@ -499,7 +502,7 @@ export default {
// 设置上传的请求头部
headers
:
{
Authorization
:
'Bearer '
+
getToken
()
},
// 上传的地址
url
:
process
.
env
.
VUE_APP_BASE_API
+
'/system/user/import
Data
'
url
:
process
.
env
.
VUE_APP_BASE_API
+
'/system/user/import
Excel
'
},
// 查询参数
queryParams
:
{
...
...
@@ -854,7 +857,49 @@ export default {
},
// 提交上传文件
submitFileForm
()
{
this
.
$refs
.
upload
.
submit
()
// this.$refs.upload.submit()
this
.
importLoading
=
true
if
(
this
.
fileList
.
length
===
0
)
{
this
.
$message
.
warning
(
'请上传文件'
)
// 导入成功后关闭弹出框
this
.
importLoading
=
false
this
.
upload
.
open
=
true
}
else
{
// 根据后台需求数据格式
var
formData
=
new
FormData
()
// 当前为空
formData
.
append
(
'file'
,
this
.
fileList
)
importExcel
(
formData
).
then
(
res
=>
{
if
(
res
.
code
===
200
)
{
if
(
res
.
data
.
filename
===
null
)
{
this
.
$message
.
success
(
'导入成功'
)
this
.
fileList
=
[]
// 导入成功后关闭弹出框
this
.
importLoading
=
false
this
.
upload
.
open
=
true
// 导入成功后刷新页面
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
}
else
if
(
res
.
code
===
41020
)
{
this
.
$message
.
info
(
'上传超时,请重新上传'
)
this
.
importLoading
=
false
}
}).
catch
(
err
=>
{
this
.
$message
.
success
(
err
.
message
)
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