|
@@ -105,10 +105,11 @@ module.exports = {
|
|
|
let filter = {"ID": rptDftTplId};
|
|
|
RptTplModel.findOne(filter, '-_id').exec().then(function(dftTplRst) {
|
|
|
if (dftTplRst) {
|
|
|
- dftTplRst["ID"] = treeNodeId;
|
|
|
- dftTplRst["GROUP_KEY"] = "";
|
|
|
- dftTplRst["ID_KEY"] = "";
|
|
|
- let rptTpl = new RptTplModel(dftTplRst);
|
|
|
+ let _doc = dftTplRst["_doc"];
|
|
|
+ _doc["ID"] = treeNodeId;
|
|
|
+ _doc["GROUP_KEY"] = "";
|
|
|
+ _doc["ID_KEY"] = "";
|
|
|
+ let rptTpl = new RptTplModel(_doc);
|
|
|
rptTpl.save(function (err, actTplRst) {
|
|
|
if (err) {
|
|
|
callback(req,res, "报表模板创建错误", "", null);
|
|
@@ -127,5 +128,17 @@ module.exports = {
|
|
|
callback(req, res, 'Create report template failed!', null);
|
|
|
}
|
|
|
})
|
|
|
+ },
|
|
|
+ getRefRptTpl: function (req, res) {
|
|
|
+ let params = JSON.parse(req.body.params),
|
|
|
+ rptTplId = params.rptTplId;
|
|
|
+ let filter = {"ID": rptTplId};
|
|
|
+ RptTplModel.findOne(filter, '-_id').exec().then(function(rstTpl) {
|
|
|
+ if (rstTpl) {
|
|
|
+ callback(req,res, false, "", rstTpl);
|
|
|
+ } else {
|
|
|
+ callback(req, res, 'The report template was not found!', null);
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
}
|