|
@@ -5,10 +5,12 @@
|
|
|
|
|
|
const indexDbOprObj = {
|
|
const indexDbOprObj = {
|
|
currentDb: null,
|
|
currentDb: null,
|
|
|
|
+ tb_name_request: 'tb_ReportRequests', // 记录报表请求信息,在不同的场景传递中有用
|
|
|
|
+ tb_name_page: 'tb_ReportPages', // 记录已请求并返回的报表结果信息
|
|
iniDb: function (dbName, version) {
|
|
iniDb: function (dbName, version) {
|
|
let rst = window.indexedDB.open(dbName, version);
|
|
let rst = window.indexedDB.open(dbName, version);
|
|
rst.onsuccess = function (event) {
|
|
rst.onsuccess = function (event) {
|
|
- indexDbOprObj.currentDb = event.target.result;;
|
|
|
|
|
|
+ indexDbOprObj.currentDb = event.target.result;
|
|
console.log('数据库打开成功!');
|
|
console.log('数据库打开成功!');
|
|
};
|
|
};
|
|
rst.onupgradeneeded = function (event) {
|
|
rst.onupgradeneeded = function (event) {
|
|
@@ -21,173 +23,292 @@ const indexDbOprObj = {
|
|
_iniTable: function(db) {
|
|
_iniTable: function(db) {
|
|
if (db) {
|
|
if (db) {
|
|
//本地表,主要是用来储存报表结果对象,主要是为PDF多表导出用,当然,其他方式也是可以用的(如打印),看实际需要
|
|
//本地表,主要是用来储存报表结果对象,主要是为PDF多表导出用,当然,其他方式也是可以用的(如打印),看实际需要
|
|
- if (!db.objectStoreNames.contains('tb_ReportPages')) {
|
|
|
|
- db.createObjectStore('tb_ReportPages', { keyPath: 'id' });
|
|
|
|
|
|
+ if (!db.objectStoreNames.contains(this.tb_name_page)) {
|
|
|
|
+ db.createObjectStore(this.tb_name_page, { keyPath: 'id' });
|
|
}
|
|
}
|
|
- if (!db.objectStoreNames.contains('tb_ReportRequests')) {
|
|
|
|
- db.createObjectStore('tb_ReportRequests', { keyPath: 'id' });
|
|
|
|
|
|
+ if (!db.objectStoreNames.contains(this.tb_name_request)) {
|
|
|
|
+ db.createObjectStore(this.tb_name_request, { keyPath: 'id' });
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
},
|
|
batchAdd: function (tbName, datas, cb) {
|
|
batchAdd: function (tbName, datas, cb) {
|
|
let db = indexDbOprObj.currentDb;
|
|
let db = indexDbOprObj.currentDb;
|
|
let ttlAmt = datas.length;
|
|
let ttlAmt = datas.length;
|
|
- console.log(`已选报表数量:${ttlAmt}`);
|
|
|
|
|
|
+ // console.log(`已选报表数量:${ttlAmt}`);
|
|
let cnt = 0;
|
|
let cnt = 0;
|
|
- let request = db.transaction([tbName], 'readwrite').objectStore(tbName);
|
|
|
|
- request.onsuccess = function (event) {
|
|
|
|
- cnt++;
|
|
|
|
- console.log(`已选加数量:${cnt}`);
|
|
|
|
- if (cnt === ttlAmt && cb) {
|
|
|
|
- cb(datas);
|
|
|
|
- }
|
|
|
|
- };
|
|
|
|
|
|
+ let store = db.transaction([tbName], 'readwrite').objectStore(tbName);
|
|
for (let data of datas) {
|
|
for (let data of datas) {
|
|
- request.add(data);
|
|
|
|
|
|
+ let request = store.add(data);
|
|
|
|
+ request.onsuccess = function (event) {
|
|
|
|
+ cnt++;
|
|
|
|
+ // console.log(`已选加数量:${cnt}`);
|
|
|
|
+ if (cnt === ttlAmt && cb) {
|
|
|
|
+ cb(datas);
|
|
|
|
+ }
|
|
|
|
+ };
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- _addDummy: function() {
|
|
|
|
- let db = indexDbOprObj.currentDb;
|
|
|
|
- // let request = db.transaction(['tb_ReportRequests'], 'readwrite')
|
|
|
|
- db.transaction(['tb_ReportRequests'], 'readwrite')
|
|
|
|
- .objectStore('tb_ReportRequests')
|
|
|
|
- .add({ id: '_2830_1725', name: '多人协同2', pageSize: 'A4', CFG: null, prj_ids: [123,456,789] });
|
|
|
|
- // request.onsuccess = function (event) {
|
|
|
|
- // console.log('数据写入成功');
|
|
|
|
- // };
|
|
|
|
- //
|
|
|
|
- // request.onerror = function (event) {
|
|
|
|
- // console.log('数据写入失败');
|
|
|
|
- // }
|
|
|
|
-
|
|
|
|
- db.transaction(['tb_ReportRequests'], 'readwrite')
|
|
|
|
- .objectStore('tb_ReportRequests')
|
|
|
|
- .add({ id: '_2830_1728', name: '多人协同3', pageSize: 'A3', CFG: null, prj_ids: [668] });
|
|
|
|
- },
|
|
|
|
- _updateDummy: function () {
|
|
|
|
|
|
+ getOne: function (tbName, id, cb = null) {
|
|
let db = indexDbOprObj.currentDb;
|
|
let db = indexDbOprObj.currentDb;
|
|
- let request = db.transaction(['tb_ReportRequests'], 'readwrite')
|
|
|
|
- .objectStore('tb_ReportRequests')
|
|
|
|
- .put({ id: '_2830_1725', name: '多人协同2', pageSize: 'A4', CFG: 'CFG', prj_ids: [1,2,3] });
|
|
|
|
-
|
|
|
|
|
|
+ // let objectStore = db.transaction(tbName).objectStore(tbName);
|
|
|
|
+ let objectStore = db.transaction([tbName], 'readwrite').objectStore(tbName);
|
|
|
|
+ let request = objectStore.get(id);
|
|
request.onsuccess = function (event) {
|
|
request.onsuccess = function (event) {
|
|
- console.log('数据写入成功');
|
|
|
|
- };
|
|
|
|
-
|
|
|
|
- request.onerror = function (event) {
|
|
|
|
- console.log('数据写入失败');
|
|
|
|
|
|
+ let data = event.target.result;
|
|
|
|
+ if (cb) cb(data);
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- _getDummy: function () {
|
|
|
|
- let db = indexDbOprObj.currentDb;
|
|
|
|
- let transaction = db.transaction(['tb_ReportRequests']);
|
|
|
|
- let objectStore = transaction.objectStore('tb_ReportRequests');
|
|
|
|
- let request = objectStore.get('_2830_1725');
|
|
|
|
-
|
|
|
|
- request.onerror = function(event) {
|
|
|
|
- console.log('事务失败');
|
|
|
|
- };
|
|
|
|
-
|
|
|
|
- request.onsuccess = function(event) {
|
|
|
|
- if (request.result) {
|
|
|
|
- console.log('Name: ' + request.result.name);
|
|
|
|
- console.log('PageSize: ' + request.result.pageSize);
|
|
|
|
- console.log('CFG: ' + request.result.CFG);
|
|
|
|
- console.log('ProjectIds: ' + request.result.prj_ids);
|
|
|
|
- } else {
|
|
|
|
- console.log('未获得数据记录');
|
|
|
|
- }
|
|
|
|
- };
|
|
|
|
- },
|
|
|
|
- _getDummyAll: function (idRst, cb) {
|
|
|
|
|
|
+ getAll: function (tbName, idRst, cb = null) {
|
|
let db = indexDbOprObj.currentDb;
|
|
let db = indexDbOprObj.currentDb;
|
|
- let objectStore = db.transaction('tb_ReportRequests').objectStore('tb_ReportRequests');
|
|
|
|
-
|
|
|
|
|
|
+ let objectStore = db.transaction(tbName).objectStore(tbName);
|
|
|
|
+ let amt = 0;
|
|
objectStore.openCursor().onsuccess = function (event) {
|
|
objectStore.openCursor().onsuccess = function (event) {
|
|
let cursor = event.target.result;
|
|
let cursor = event.target.result;
|
|
-
|
|
|
|
if (cursor) {
|
|
if (cursor) {
|
|
- console.log('Id: ' + cursor.key);
|
|
|
|
- console.log('Name: ' + cursor.value.name);
|
|
|
|
- console.log('PageSize: ' + cursor.value.pageSize);
|
|
|
|
- console.log('gather_select: ' + cursor.value.gather_select);
|
|
|
|
- console.log('stage_select: ' + cursor.value.stage_select);
|
|
|
|
- console.log('CFG: ');
|
|
|
|
- console.log(cursor.value.CFG);
|
|
|
|
if (idRst) {
|
|
if (idRst) {
|
|
idRst.push(cursor.key);
|
|
idRst.push(cursor.key);
|
|
}
|
|
}
|
|
|
|
+ amt++;
|
|
cursor.continue();
|
|
cursor.continue();
|
|
} else {
|
|
} else {
|
|
- console.log('没有更多数据了!');
|
|
|
|
|
|
+ console.log(`已取数量:${amt}`);
|
|
if (cb) {
|
|
if (cb) {
|
|
cb(idRst);
|
|
cb(idRst);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
};
|
|
},
|
|
},
|
|
- _removeDummy: function () {
|
|
|
|
- let db = indexDbOprObj.currentDb;
|
|
|
|
- let request = db.transaction(['tb_ReportRequests'], 'readwrite')
|
|
|
|
- .objectStore('tb_ReportRequests')
|
|
|
|
- .delete('_2830_1725');
|
|
|
|
-
|
|
|
|
- request.onsuccess = function (event) {
|
|
|
|
- console.log('数据删除成功');
|
|
|
|
- };
|
|
|
|
-
|
|
|
|
- request.onerror = function (event) {
|
|
|
|
- console.log('数据删除失败');
|
|
|
|
|
|
+ storeReportRequest: function (stage_id, rptNodes, cb = null) {
|
|
|
|
+ if (rptNodes && rptNodes.length > 0) {
|
|
|
|
+ indexDbOprObj.removeAll(()=>{
|
|
|
|
+ let datas = [];
|
|
|
|
+ for (let node of rptNodes) {
|
|
|
|
+ let keyStr = `_${stage_id}_${node.refId}`;
|
|
|
|
+ const gather_select = customSelects.gather_select.find(function (x) {
|
|
|
|
+ return x.id === node.refId;
|
|
|
|
+ });
|
|
|
|
+ const stage_select = customSelects.stage_select.find(function (x) {
|
|
|
|
+ return x.id === node.refId;
|
|
|
|
+ });
|
|
|
|
+ let data = {id: keyStr, name: node.name, rpt_id: node.refId, stage_id, gather_select, stage_select, pageSize: rptControlObj.getCurrentPageSize(), CFG: CUST_CFG};
|
|
|
|
+ datas.push(data);
|
|
|
|
+ }
|
|
|
|
+ indexDbOprObj.batchAdd(this.tb_name_request, datas, (rstArr)=>{
|
|
|
|
+ console.log('batch add succeeded!');
|
|
|
|
+ console.log(rstArr);
|
|
|
|
+ //其他操作
|
|
|
|
+ if (rstArr.length > 0 && cb) {
|
|
|
|
+ cb(stage_id, rptNodes);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ });
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- _test: function () {
|
|
|
|
- // indexDbOprObj._addDummy();
|
|
|
|
- // indexDbOprObj._getDummy();
|
|
|
|
|
|
+ startRequestReport: async function(stage_id, rptNodes) {
|
|
|
|
+ //划重点:这里要能处理所有相关的报表请求,除非是带选择的,否则就要静悄悄地处理完,带选择的只需要选择一次同类型的!!!
|
|
|
|
+ //第一步:只需要请求数据并保存
|
|
|
|
+ //第二步:所有请求数据完备后,才开始转PDF并上传
|
|
|
|
+ //所有这些处理都是异步的!!!
|
|
|
|
+ //1. 开始,初始化
|
|
|
|
+ let gather_select_param = null;
|
|
|
|
+ let stage_select_param = null;
|
|
let idRst = [];
|
|
let idRst = [];
|
|
- indexDbOprObj._getDummyAll(idRst, (ids)=>{
|
|
|
|
- console.log(ids);
|
|
|
|
- // indexDbOprObj.removeAll(ids);
|
|
|
|
- });
|
|
|
|
- // indexDbOprObj._updateDummy();
|
|
|
|
- // indexDbOprObj._removeDummy();
|
|
|
|
- },
|
|
|
|
- storeReportRequest: function (stage_id, rptNodes) {
|
|
|
|
- if (rptNodes && rptNodes.length > 0) {
|
|
|
|
- let datas = [];
|
|
|
|
- for (let node of rptNodes) {
|
|
|
|
- let keyStr = `_${stage_id}_${node.refId}`;
|
|
|
|
- const gather_select = customSelects.gather_select.find(function (x) {
|
|
|
|
- return x.id === node.refId;
|
|
|
|
|
|
+ let normal_request = [], gather_request = [], stage_request = [];
|
|
|
|
+ let db = indexDbOprObj.currentDb;
|
|
|
|
+ let needWaterMark = false;
|
|
|
|
+ if (COMMON_WATER_MARK_PIC_DATA === null || COMMON_WATER_MARK_PIC_DATA === '') {
|
|
|
|
+ needWaterMark = true;
|
|
|
|
+ }
|
|
|
|
+ const _requestNormalReport = async function() {
|
|
|
|
+ let refRptTplIds = [], rpt_names = [];
|
|
|
|
+ for (let req of normal_request) {
|
|
|
|
+ //{id: keyStr, name: node.name, rpt_id: node.refId, stage_id, gather_select, stage_select, pageSize: rptControlObj.getCurrentPageSize(), CFG: CUST_CFG}
|
|
|
|
+ refRptTplIds.push(req.rpt_id);
|
|
|
|
+ rpt_names.push(req.name);
|
|
|
|
+ }
|
|
|
|
+ let params = rptControlObj.creatCommonExportParam(refRptTplIds);
|
|
|
|
+ await rptCustomObj.getCustomSelect(params);
|
|
|
|
+ // params.customSelect = [];
|
|
|
|
+ params.needWaterMark = needWaterMark;
|
|
|
|
+ indexDbOprObj._getRptDataForDb(params, rpt_names, stage_id, (records)=>{
|
|
|
|
+ console.log('the normal type page results have been saved!');
|
|
|
|
+ // console.log(records);
|
|
|
|
+ _createPDF(0, records, rptNodes, ()=>{
|
|
|
|
+ console.log('the normal type archive PDFs have been created!');
|
|
|
|
+ let ids = [];
|
|
|
|
+ for (let rec of records) {
|
|
|
|
+ ids.push(rec.id);
|
|
|
|
+ }
|
|
|
|
+ indexDbOprObj.remove(indexDbOprObj.tb_name_request, ids);
|
|
|
|
+ indexDbOprObj.remove(indexDbOprObj.tb_name_page, ids);
|
|
|
|
+ _requestGatherReport();
|
|
});
|
|
});
|
|
- const stage_select = customSelects.stage_select.find(function (x) {
|
|
|
|
- return x.id === node.refId;
|
|
|
|
|
|
+ });
|
|
|
|
+ };
|
|
|
|
+ const _requestGatherReport = function() {
|
|
|
|
+ if (gather_request.length > 0) {
|
|
|
|
+ let refRptTplIds = [], rpt_names = [];
|
|
|
|
+ for (let req of gather_request) {
|
|
|
|
+ //{id: keyStr, name: node.name, rpt_id: node.refId, stage_id, gather_select, stage_select, pageSize: rptControlObj.getCurrentPageSize(), CFG: CUST_CFG}
|
|
|
|
+ refRptTplIds.push(req.rpt_id);
|
|
|
|
+ rpt_names.push(req.name);
|
|
|
|
+ }
|
|
|
|
+ let params = rptControlObj.creatCommonExportParam(refRptTplIds);
|
|
|
|
+ params.customSelect = [];
|
|
|
|
+ params.needWaterMark = needWaterMark;
|
|
|
|
+ indexDbOprObj._getRptDataForDb(params, rpt_names, stage_id, (records)=>{
|
|
|
|
+ console.log('the normal type page results have been saved!');
|
|
|
|
+ // console.log(records);
|
|
|
|
+ _createPDF(0, records, rptNodes, ()=>{
|
|
|
|
+ console.log('the normal type archive PDFs have been created!');
|
|
|
|
+ let ids = [];
|
|
|
|
+ for (let rec of records) {
|
|
|
|
+ ids.push(rec.id);
|
|
|
|
+ }
|
|
|
|
+ indexDbOprObj.remove(indexDbOprObj.tb_name_request, ids);
|
|
|
|
+ indexDbOprObj.remove(indexDbOprObj.tb_name_page, ids);
|
|
|
|
+ _requestStageReport();
|
|
|
|
+ });
|
|
});
|
|
});
|
|
- let data = {id: keyStr, name: node.name, gather_select, stage_select, pageSize: rptControlObj.getCurrentPageSize(), CFG: CUST_CFG};
|
|
|
|
- datas.push(data);
|
|
|
|
|
|
+ } else {
|
|
|
|
+ _requestStageReport();
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+ const _requestStageReport = function() {
|
|
|
|
+ console.log('go on stage report...');
|
|
|
|
+ };
|
|
|
|
+ indexDbOprObj.getAll(indexDbOprObj.tb_name_request, idRst, (ids)=>{
|
|
|
|
+ if (ids && ids.length > 0) {
|
|
|
|
+ let cnt = 0;
|
|
|
|
+ let store = db.transaction([indexDbOprObj.tb_name_request], 'readwrite').objectStore(indexDbOprObj.tb_name_request);
|
|
|
|
+ for (let id of ids) {
|
|
|
|
+ let request = store.get(id);
|
|
|
|
+ request.onsuccess = function(event) {
|
|
|
|
+ cnt++;
|
|
|
|
+ if (request.result) {
|
|
|
|
+ // if (request.result.gather_select) {
|
|
|
|
+ // gather_request.push(request.result);
|
|
|
|
+ // } else if (request.result.stage_select) {
|
|
|
|
+ // stage_request.push(request.result);
|
|
|
|
+ // } else {
|
|
|
|
+ // normal_request.push(request.result);
|
|
|
|
+ // }
|
|
|
|
+ normal_request.push(request.result);
|
|
|
|
+ } else {
|
|
|
|
+ // console.log('未获得数据记录');
|
|
|
|
+ }
|
|
|
|
+ if (cnt === ids.length) {
|
|
|
|
+ //下一步处理
|
|
|
|
+ _requestNormalReport();
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- indexDbOprObj.batchAdd('tb_ReportRequests', datas, (rstArr)=>{
|
|
|
|
- console.log('batch add succeeded!');
|
|
|
|
- console.log(rstArr);
|
|
|
|
- //其他操作
|
|
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ removeAll: function(cb = null) {
|
|
|
|
+ let tbArr = [indexDbOprObj.tb_name_request, indexDbOprObj.tb_name_page];
|
|
|
|
+ let tbAmt = 0;
|
|
|
|
+ for (let tbName of tbArr) {
|
|
|
|
+ tbAmt++;
|
|
|
|
+ let idRst = [];
|
|
|
|
+ indexDbOprObj.getAll(tbName, idRst, (ids)=>{
|
|
|
|
+ if (ids && ids.length > 0) {
|
|
|
|
+ let db = indexDbOprObj.currentDb;
|
|
|
|
+ let store = db.transaction([tbName], 'readwrite').objectStore(tbName);
|
|
|
|
+ let amt = 0;
|
|
|
|
+ for (let id of ids) {
|
|
|
|
+ let req = store.delete(id);
|
|
|
|
+ req.onsuccess = function (event) {
|
|
|
|
+ amt++;
|
|
|
|
+ if (tbAmt === tbArr.length && amt === ids.length && cb) {
|
|
|
|
+ cb();
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ } else if (tbAmt === tbArr.length && cb) {
|
|
|
|
+ cb();
|
|
|
|
+ }
|
|
});
|
|
});
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- storeReportPages: function (rptPages, stage_id, rptNode) {
|
|
|
|
- //
|
|
|
|
- },
|
|
|
|
- removeAll: function(idArr) {
|
|
|
|
- if (idArr && idArr.length > 0) {
|
|
|
|
|
|
+ remove: function(tbName, ids) {
|
|
|
|
+ if (ids && ids.length > 0) {
|
|
let db = indexDbOprObj.currentDb;
|
|
let db = indexDbOprObj.currentDb;
|
|
- let request = db.transaction(['tb_ReportRequests'], 'readwrite').objectStore('tb_ReportRequests');
|
|
|
|
- for (let id of idArr) {
|
|
|
|
- request.delete(id);
|
|
|
|
- request.onsuccess = function (event) {
|
|
|
|
- console.log(`数据('${id}')删除成功`);
|
|
|
|
- };
|
|
|
|
|
|
+ let store = db.transaction([tbName], 'readwrite').objectStore(tbName);
|
|
|
|
+ for (let id of ids) {
|
|
|
|
+ store.delete(id);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- getReportPages: function (rpt_id, stage_id) {
|
|
|
|
|
|
+ _getRptDataForDb: function(params, rpt_names, stage_id, cb) {
|
|
|
|
+ CommonAjax.postXsrfEx("/tender/report_api/getMultiReports", params, 60000, true, getCookie('csrfToken_j'),
|
|
|
|
+ function(result){
|
|
|
|
+ const signatureRelArr = [];
|
|
|
|
+ STAGE_AUDIT = result.stageAudit;
|
|
|
|
+ if (params.needWaterMark) sessionStorage.waterMarkStr = result.waterMarkStr;
|
|
|
|
+ for (const signatureRel of result.signatureRelInfo) {
|
|
|
|
+ signatureRelArr.push(JSON.parse(signatureRel.rel_content));
|
|
|
|
+ }
|
|
|
|
+ for (let idx = 0; idx < result.data.length; idx++) {
|
|
|
|
+ let singleSignatureRelArr = [];
|
|
|
|
+ for (let rIdx = 0; rIdx < result.signatureRelInfo.length; rIdx++) {
|
|
|
|
+ if (result.signatureRelInfo[rIdx].rpt_id === params.rpt_ids[idx]) {
|
|
|
|
+ singleSignatureRelArr = signatureRelArr[rIdx]; // 有些报表可能没有签名
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (params.stage_status === 3) {
|
|
|
|
+ rptSignatureHelper.mergeSignDate(result.data[idx], singleSignatureRelArr, false);
|
|
|
|
+ rptSignatureHelper.mergeSignature(result.data[idx], singleSignatureRelArr);
|
|
|
|
+ rptSignatureHelper.mergeSignAudit(result.data[idx], singleSignatureRelArr, result.stageAudit);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ let multiRptData = result.data;
|
|
|
|
+ let datas = [];
|
|
|
|
+ for (let idx = 0; idx < multiRptData.length; idx++) {
|
|
|
|
+ // this._storeReportPages(multiRptData[idx], stage_id, params.rpt_ids[idx], cb);
|
|
|
|
+ let keyStr = `_${stage_id}_${params.rpt_ids[idx]}`;
|
|
|
|
+ let data = {id: keyStr, rpt_id: params.rpt_ids[idx], rpt_name: rpt_names[idx], stage_id, pageData: multiRptData[idx]};
|
|
|
|
+ datas.push(data);
|
|
|
|
+ }
|
|
|
|
+ indexDbOprObj.batchAdd(indexDbOprObj.tb_name_page, datas, (rstArr)=>{
|
|
|
|
+ cb(rstArr);
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ function(failRst){
|
|
|
|
+ // sessionStorage.currentPageData = null;
|
|
|
|
+ console.log(failRst);
|
|
|
|
+ },
|
|
|
|
+ function(exceptionRst){
|
|
|
|
+ // sessionStorage.currentPageData = null;
|
|
|
|
+ console.log(exceptionRst);
|
|
|
|
+ }
|
|
|
|
+ );
|
|
|
|
+ },
|
|
|
|
+ _startToCreatePDF: function(idArr) {
|
|
//
|
|
//
|
|
}
|
|
}
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+function _createPDF(currentIdx, records, rptNodes, cb) {
|
|
|
|
+ if (currentIdx === records.length) {
|
|
|
|
+ if (cb) {
|
|
|
|
+ cb();
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ let rec = records[currentIdx];
|
|
|
|
+ let nextIdx = currentIdx + 1;
|
|
|
|
+ indexDbOprObj.getOne(indexDbOprObj.tb_name_page, rec.id, (record)=>{
|
|
|
|
+ for (let node of rptNodes) {
|
|
|
|
+ if (node.refId === record.rpt_id) {
|
|
|
|
+ rptArchiveObj.archiveCurrentReport(record.pageData, node, (err, msg, uuid)=>{
|
|
|
|
+ _createPDF(nextIdx, records, rptNodes, cb);
|
|
|
|
+ });
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
};
|
|
};
|