load() {
// var subreports = ['/SubReport1.rdlx-json', '/SubReport2.rdlx-json', '/SubReport3.rdlx-json'];
var reportItems = [];
var subreportItem = "";
var subreportvalue = "";
var subreportTemplate = {
ZIndex: 1,
Type: "subreport",
Top: "",
Width: "6.5in",
Height: "2in",
ReportName: "",
Name: "Subreport",
};
//default top position of subreport. Can be any position by default. Also heigh/width can be modified too if necessary
var topPosition = 0;
var defaultHeight = 2;
console.log("reportFile::", JSON.parse(this.reportFile[0]));
// subreports.definition.forEach((subreport, index) => {
console.log("subreports.length::" + this.reportFile.length);
for (var i = 0; i < this.reportFile.length; i++) {
subreportvalue = JSON.parse(this.reportFile[i]);
console.log("subreport::", subreportvalue.definition);
var subreportItem = { ...subreportTemplate };
subreportItem.ReportName = subreportvalue.displayName+'.rdlx-json';
subreportItem.Name = "Subreport" + i;
subreportItem.Top = topPosition + "in";
reportItems.push(subreportItem);
topPosition = topPosition + defaultHeight;
}
console.log("reportItems::", reportItems);
// });
//fetch doesn't work in IE
var reportDefinition = this.reportFilezhu.definition;
console.log("aaa::", reportDefinition);
//in case if report is empty at all
if (!reportDefinition.Body.ReportItems) console.log("进来了");
reportDefinition.Body.ReportItems = [];
reportDefinition.Body.ReportItems.push(...reportItems);
this.$refs.reportViewer.Viewer().open(reportDefinition); //表
console.log("reportDefinition::", reportDefinition);
console.log("出来了");
},
|