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

fix components

parent 56b5606e
......@@ -372,6 +372,12 @@ this.ReportComponent = class {
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() {
try {
if(!this.selectorContainer) throw new Error('Не передан селектор контейнера для отрисовки кнопки');
......@@ -380,14 +386,21 @@ this.ReportComponent = class {
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();
rest.synergyGet('api/report/list', res => {
if(this.registryCode) {
this.reportList = res.filter(x => x.objectType == this.objectType && x.objectCode == this.registryCode);
} else {
this.reportList = res.filter(x => x.objectType == this.objectType);
}
this.reportList = res.filter(x => {
const typeMatch = this.objectType.includes(x.objectType);
if (this.registryCode) {
return typeMatch && x.objectCode == this.registryCode;
} else {
return typeMatch;
}
});
this.createReportMenu();
});
......
......@@ -141,7 +141,8 @@ this.StartRegistryRoute = class {
Cons.hideLoader();
this.closeDialog();
if(isShowRoute(this.registryRoute)) this.closeDialog();
if(this.registryRoute.closeAfterActivation === "true") this.closeDocument(this._doc);
} 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