Commit 3a5f8ff1 by 蒋勇

d

parent df2b5015
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,
......
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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment