Commit bd122c8d authored by Samir Sadyhov's avatar Samir Sadyhov 🤔

fix components

parent 56b5606e
...@@ -372,6 +372,12 @@ this.ReportComponent = class { ...@@ -372,6 +372,12 @@ this.ReportComponent = class {
this.componentContainer.append(container); this.componentContainer.append(container);
} }
checkObjectTypeMatch() {
if (!this.objectType) return false;
this.objectType = Array.isArray(this.objectType) ? this.objectType : [this.objectType];
return this.objectType.some(t => objectTypes.includes(Number(t)));
}
init() { init() {
try { try {
if(!this.selectorContainer) throw new Error('Не передан селектор контейнера для отрисовки кнопки'); if(!this.selectorContainer) throw new Error('Не передан селектор контейнера для отрисовки кнопки');
...@@ -380,14 +386,21 @@ this.ReportComponent = class { ...@@ -380,14 +386,21 @@ this.ReportComponent = class {
if(!this.componentContainer || !this.componentContainer.length) throw new Error('Не передан или передан некорректный селектор контейнера'); if(!this.componentContainer || !this.componentContainer.length) throw new Error('Не передан или передан некорректный селектор контейнера');
if(!this.checkObjectTypeMatch()) throw new Error(`ERROR ReportComponent: objectType not supported [objectType: ${this.objectType}]`);
this.renderHTML(); this.renderHTML();
rest.synergyGet('api/report/list', res => { rest.synergyGet('api/report/list', res => {
if(this.registryCode) { this.reportList = res.filter(x => {
this.reportList = res.filter(x => x.objectType == this.objectType && x.objectCode == this.registryCode); const typeMatch = this.objectType.includes(x.objectType);
if (this.registryCode) {
return typeMatch && x.objectCode == this.registryCode;
} else { } else {
this.reportList = res.filter(x => x.objectType == this.objectType); return typeMatch;
} }
});
this.createReportMenu(); this.createReportMenu();
}); });
......
...@@ -141,7 +141,8 @@ this.StartRegistryRoute = class { ...@@ -141,7 +141,8 @@ this.StartRegistryRoute = class {
Cons.hideLoader(); Cons.hideLoader();
this.closeDialog();
if(isShowRoute(this.registryRoute)) this.closeDialog();
if(this.registryRoute.closeAfterActivation === "true") this.closeDocument(this._doc); if(this.registryRoute.closeAfterActivation === "true") this.closeDocument(this._doc);
} catch (err) { } catch (err) {
......
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