Commit 115e7864 authored by Samir Sadyhov's avatar Samir Sadyhov 🤔

доработка компонентов по реестрам, для компонента фильтра

parent 86cac93c
......@@ -29,12 +29,23 @@ const KanbanBoard = {
columns: [],
searchString: null,
filterSearchUrl: null,
sum: null,
pageCode: null,
stringLength: 50,
getUrlParam: function(column){
getNextFieldNumber: function(url) {
let p = url.substring(url.indexOf('?') + 1).split('&');
p = p.map(x => {
x = x.split('=');
if(x[0].indexOf('field') !== -1 && x[0] !== 'fields') return x[0];
}).filter(x => x).sort();
if(p.length) return Number(p[p.length - 1].substring(5)) + 1;
return '';
},
getUrlParam: function(column) {
const {key, currentPage, countInPart} = column;
let param = `?registryCode=${this.registryCode}`;
if(this.filterCode) param += `&filterCode=${this.filterCode}`;
......@@ -43,7 +54,17 @@ const KanbanBoard = {
param+=`&fields=${this.fieldDict}`;
}
if(this.searchString) param += `&searchString=${this.searchString}`;
if(this.filterSearchUrl) {
param += this.filterSearchUrl;
if(key) {
let next = this.getNextFieldNumber(this.filterSearchUrl);
param += `&field${next}=${this.fieldDict}&condition${next}=TEXT_EQUALS&key${next}=${key}`;
}
} else {
if(key) param += `&field=${this.fieldDict}&condition=TEXT_EQUALS&key=${key}`;
}
param += `&pageNumber=${currentPage}&countInPart=${countInPart}`;
return param;
},
......@@ -61,7 +82,17 @@ const KanbanBoard = {
let param = `?registryCode=${this.registryCode}`;
if(this.filterCode) param += `&filterCode=${this.filterCode}`;
if(this.searchString) param += `&searchString=${this.searchString}`;
if(this.filterSearchUrl) {
param += this.filterSearchUrl;
if(key) {
let next = this.getNextFieldNumber(this.filterSearchUrl);
param += `&field${next}=${this.fieldDict}&condition${next}=TEXT_EQUALS&key${next}=${key}`;
}
} else {
if(key) param += `&field=${this.fieldDict}&condition=TEXT_EQUALS&key=${key}`;
}
param += `&fieldCode=${fieldCode}&countType=sum`;
return new Promise(resolve => {
......@@ -468,20 +499,20 @@ compContainer.off()
KanbanBoard.render();
}).on('searchInRegistry', e => {
if(!e.hasOwnProperty('eventParam')) return;
if(e.eventParam.searchString && e.eventParam.searchString !== "") {
KanbanBoard.searchString = e.eventParam.searchString;
} else {
KanbanBoard.searchString = null;
}
const {searchString = null} = e.eventParam;
KanbanBoard.searchString = searchString;
KanbanBoard.reset();
KanbanBoard.render();
}).on('changeFilterCode', e => {
if(!e.hasOwnProperty('eventParam')) return;
if(e.eventParam.filterCode && e.eventParam.filterCode !== "") {
KanbanBoard.filterCode = e.eventParam.filterCode;
} else {
KanbanBoard.filterCode = null;
}
const {filterCode = null} = e.eventParam;
KanbanBoard.filterCode = filterCode;
KanbanBoard.reset();
KanbanBoard.render();
}).on('filterRegistryRows', e => {
if(!e.hasOwnProperty('eventParam')) return;
const {filterSearchUrl} = e.eventParam;
KanbanBoard.filterSearchUrl = filterSearchUrl;
KanbanBoard.reset();
KanbanBoard.render();
});
......
......@@ -598,22 +598,15 @@ compContainer.off()
})
.on('searchInRegistry', e => {
if(!e.hasOwnProperty('eventParam')) return;
if(e.eventParam.searchString && e.eventParam.searchString !== "") {
registryTable.searchString = e.eventParam.searchString;
} else {
registryTable.searchString = null;
}
const {searchString = null} = e.eventParam;
registryTable.searchString = searchString;
Paginator.currentPage = 1;
registryTable.createBody();
})
.on('filterRegistryRows', e => {
if(!e.hasOwnProperty('eventParam')) return;
if(e.eventParam.filterSearchUrl && e.eventParam.filterSearchUrl !== "") {
registryTable.filterSearchUrl = e.eventParam.filterSearchUrl;
} else {
registryTable.filterSearchUrl = null;
return;
}
const {filterSearchUrl = null} = e.eventParam;
registryTable.filterSearchUrl = filterSearchUrl;
Paginator.currentPage = 1;
registryTable.createBody();
});
......
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