Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pisns-forum-api
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
scrmGroup
pisns-forum-api
Commits
0189e45b
Commit
0189e45b
authored
Aug 03, 2015
by
陈家荣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
导出板块excel表英文名称改成中文名称
parent
07765f17
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
115 additions
and
91 deletions
+115
-91
forumInfo.js
app/controllers/admin/forumInfo.js
+115
-91
No files found.
app/controllers/admin/forumInfo.js
View file @
0189e45b
...
...
@@ -342,6 +342,12 @@ router.get('/info/report/exportXlsReport/:id', function(req, res, next) {
all_data_array
=
get_all_date
(
begin_time
,
end_time
);
if
(
begin_time
&&
end_time
)
{
forumInfoService
.
getInfoById
(
info_id
,
function
(
err
,
info
){
if
(
err
)
{
console
.
error
(
err
);
res
.
json
(
returnCode
.
BUSY
);
}
else
{
var
uv_datas
=
[];
var
thread_datas
=
[];
...
...
@@ -427,9 +433,22 @@ router.get('/info/report/exportXlsReport/:id', function(req, res, next) {
]
);
}
var
filename
=
info
.
name
+
'报表.xlsx'
;
var
userAgent
=
(
req
.
headers
[
'user-agent'
]
||
''
).
toLowerCase
();
if
(
userAgent
.
indexOf
(
'msie'
)
>=
0
||
userAgent
.
indexOf
(
'chrome'
)
>=
0
)
{
res
.
setHeader
(
'Content-Disposition'
,
'attachment; filename='
+
encodeURIComponent
(
filename
));
}
else
if
(
userAgent
.
indexOf
(
'firefox'
)
>=
0
)
{
res
.
setHeader
(
'Content-Disposition'
,
'attachment; filename*="utf8
\'\'
'
+
encodeURIComponent
(
filename
)
+
'"'
);
}
else
{
/* safari等其他非主流浏览器只能自求多福了 */
res
.
setHeader
(
'Content-Disposition'
,
'attachment; filename='
+
new
Buffer
(
filename
).
toString
(
'binary'
));
}
var
result
=
nodeExcel
.
execute
(
conf
);
res
.
setHeader
(
'Content-Type'
,
'application/vnd.ms-excel
'
);
res
.
setHeader
(
'Content-Disposition'
,
'attachment; filename=InfoReport.xlsx'
);
res
.
setHeader
(
'Content-Type'
,
'application/vnd.ms-excel;charset=utf-8
'
);
//
res.setHeader('Content-Disposition', 'attachment; filename=InfoReport.xlsx');
res
.
end
(
result
,
'binary'
);
}).
fail
(
function
(
cont
,
err
)
{
console
.
error
(
err
);
...
...
@@ -438,6 +457,11 @@ router.get('/info/report/exportXlsReport/:id', function(req, res, next) {
err
:
err
});
});
}
});
}
else
{
res
.
json
({
result
:
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