Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zhichan
Overview
Overview
Details
Activity
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
蒋勇
zhichan
Commits
3a5f8ff1
Commit
3a5f8ff1
authored
Feb 05, 2020
by
蒋勇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d
parent
df2b5015
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
67 additions
and
62 deletions
+67
-62
fi-taxctl/app/base/service/impl/rpt/rpttypeSve.js
+2
-1
fi-taxctl/dowloaddemo.js
+65
-61
No files found.
fi-taxctl/app/base/service/impl/rpt/rpttypeSve.js
View file @
3a5f8ff1
const
system
=
require
(
"../../../system"
);
const
ServiceBase
=
require
(
"../../sve.base"
)
const
settings
=
require
(
"../../../../config/settings"
)
var
md5
=
require
(
"md5"
)
class
RptTypeService
extends
ServiceBase
{
constructor
(){
super
(
"rpt"
,
ServiceBase
.
getDaoName
(
RptTypeService
));
...
...
@@ -35,7 +36,7 @@ class RptTypeService extends ServiceBase{
batchdate
:
batch
.
batchdate
,
dateym
:
rptdate
,
rpttypecode
:
rptcode
,
position
:
hd
.
position
,
position
:
md5
(
hd
.
position
)
,
valstr
:
hd
.
valstr
,
desc
:
hd
.
desc
,
uploadrpt_id
:
rptid
,
...
...
fi-taxctl/dowloaddemo.js
View file @
3a5f8ff1
data
:
function
(){
return
{
downloadTimes
:
1
,
// 设置检查重试次数变量,
code
:
''
,
// 下载文件的code值
}
},
methods
:
{
// 创建下载文件方法
exportFile
()
{
var
self
=
this
;
var
datas
=
self
.
querydata
;
if
(
!
datas
||
datas
.
length
==
0
)
{
that
.
$message
.
warning
(
`无查询结果`
);
return
;
}
//
data:function(){
//
return {
//
downloadTimes : 1, // 设置检查重试次数变量,
//
code : '', // 下载文件的code值
//
}
//
},
//
methods : {
//
// 创建下载文件方法
//
exportFile() {
//
var self = this;
//
var datas = self.querydata;
//
if(!datas || datas.length == 0) {
//
that.$message.warning(`无查询结果`);
//
return ;
//
}
/* [{},{},{}]转换成[[],[],[]] 格式 */
var
rows
=
[];
for
(
var
dd
of
datas
)
{
var
arr
=
[];
for
(
var
_idx
in
dd
)
{
arr
.
push
(
dd
[
_idx
]);
}
rows
.
push
(
arr
);
}
this
.
code
=
""
;
/* 生成文件 */
self
.
$root
.
postReq
(
"/web/filedownloadCtl/download"
,{
rows
:
rows
}).
then
(
function
(
d
){
if
(
d
.
status
==
0
)
{
setTimeout
((
function
(){
/* d.data 返回文件标识 */
self
.
code
=
d
.
data
;
self
.
downloadFile
();
}),
2000
);
}
});
},
/* 循环检查code, 并下载文件 */
downloadFile
()
{
var
self
=
this
;
self
.
$root
.
postReq
(
"/web/filedownloadCtl/findOne"
,{
code
:
self
.
code
}).
then
(
function
(
d
){
if
(
d
.
status
==
0
)
{
if
(
d
.
data
&&
d
.
data
.
filePath
)
{
downloadTimes
=
1
;
/* 文件生成成功 */
window
.
open
(
d
.
data
.
filePath
,
"_blank"
);
}
else
{
/* 递归2秒一次,超过5次,下载失败 */
if
(
downloadTimes
>
5
)
{
downloadTimes
=
1
;
/* 下载超时 */
return
;
}
downloadTimes
=
downloadTimes
+
1
;
setTimeout
((
function
(){
self
.
downloadFile
();
}),
2000
);
}
}
});
},
}
// /* [{},{},{}]转换成[[],[],[]] 格式 */
// var rows = [];
// for(var dd of datas) {
// var arr = [];
// for(var _idx in dd) {
// arr.push(dd[_idx]);
// }
// rows.push(arr);
// }
// this.code = "";
// /* 生成文件 */
// self.$root.postReq("/web/filedownloadCtl/download",{rows : rows}).then(function(d){
// if(d.status == 0) {
// setTimeout((function(){
// /* d.data 返回文件标识 */
// self.code = d.data;
// self.downloadFile();
// }), 2000);
// }
// });
// },
// /* 循环检查code, 并下载文件 */
// downloadFile() {
// var self = this;
// self.$root.postReq("/web/filedownloadCtl/findOne",{code : self.code}).then(function(d){
// if(d.status == 0) {
// if(d.data && d.data.filePath) {
// downloadTimes = 1;
// /* 文件生成成功 */
// window.open(d.data.filePath, "_blank");
// } else {
// /* 递归2秒一次,超过5次,下载失败 */
// if(downloadTimes > 5) {
// downloadTimes = 1;
// /* 下载超时 */
// return;
// }
// downloadTimes = downloadTimes + 1;
// setTimeout((function(){
// self.downloadFile();
// }), 2000);
// }
// }
// });
// },
// }
// var md5=require("md5")
// var str=md5("abcdef")
// console.log(str);
\ No newline at end of file
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