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

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

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