class Report { constructor(report) { this.reportId = report.reportId; this.reportName = report.reportName; this.cancelDefaultLinkag = report.cancelDefaultLinkag; this.createBy = report.createBy; this.filter = report.filter; this.freeWidgetIds = report.freeWidgetIds; this.linkageGroup = report.linkageGroup; this.mobileWidgetConfig = report.mobileWidgetConfig; this.templateStyle = report.templateStyle; this.widgets = {}; for (const wId in report.widgets) { this.widgets[wId] = new Widget(report.widgets[wId]); } } /** * 找组件名是xxx的组件 * 组件名是富文本,需要解析富文本才能拿到文字信息 * 名字不应该特别复杂 */ getWidgetByName(name) { let widget; for (const wId in this.widgets) { const w = this.widgets[wId]; if (w.getPlainWidgetName() === name) { widget = w; break; } } return widget; } }