Changes to lag list
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
b5b7172b72
commit
312faeb3b0
|
@ -164,10 +164,13 @@ module.exports = Self => {
|
|||
// Get tags from all items
|
||||
const itemTagsIndex = stmts.push(
|
||||
`SELECT
|
||||
t.id,
|
||||
t.name,
|
||||
t.isFree,
|
||||
t.sourceTable,
|
||||
it.tagFk,
|
||||
it.itemFk,
|
||||
it.value,
|
||||
t.name
|
||||
it.value
|
||||
FROM tmp.ticketCalculateItem tci
|
||||
JOIN vn.itemTag it ON it.itemFk = tci.itemFk
|
||||
JOIN vn.tag t ON t.id = it.tagFk`) - 1;
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
<mg-ajax path="Tags" options="mgIndex as tags"></mg-ajax>
|
||||
<div class="vn-pa-lg" style="min-width: 18em">
|
||||
<form name="form" ng-submit="$ctrl.onSearch()">
|
||||
<vn-horizontal>
|
||||
|
@ -7,7 +6,7 @@
|
|||
vn-one
|
||||
selection="filter.tagSelection"
|
||||
ng-model="filter.tagFk"
|
||||
data="tags.model"
|
||||
data="$ctrl.resultTags"
|
||||
show-field="name"
|
||||
label="Tag"
|
||||
on-change="itemTag.value = null">
|
||||
|
@ -16,14 +15,14 @@
|
|||
<vn-horizontal ng-repeat="tagValue in filter.values">
|
||||
<vn-textfield
|
||||
vn-one
|
||||
ng-show="tag.selection.isFree !== false"
|
||||
ng-show="tag.selection.isFree != false"
|
||||
vn-id="text"
|
||||
label="Value"
|
||||
ng-model="tagValue.value">
|
||||
</vn-textfield>
|
||||
<vn-autocomplete
|
||||
vn-one
|
||||
ng-show="tag.selection.isFree === false"
|
||||
ng-show="tag.selection.isFree == false"
|
||||
url="{{$ctrl.getSourceTable(tag.selection)}}"
|
||||
label="Value"
|
||||
ng-model="tagValue.value"
|
||||
|
|
|
@ -22,7 +22,7 @@ class Controller extends SearchPanel {
|
|||
}
|
||||
|
||||
getSourceTable(selection) {
|
||||
if (!selection || selection.isFree === true)
|
||||
if (!selection || selection.isFree == true)
|
||||
return null;
|
||||
|
||||
if (selection.sourceTable) {
|
||||
|
@ -48,6 +48,7 @@ ngModule.vnComponent('vnOrderCatalogSearchPanel', {
|
|||
controller: Controller,
|
||||
bindings: {
|
||||
onSubmit: '&?',
|
||||
popover: '<?'
|
||||
popover: '<?',
|
||||
resultTags: '<?'
|
||||
}
|
||||
});
|
||||
|
|
|
@ -83,12 +83,9 @@
|
|||
</div>
|
||||
</vn-vertical>
|
||||
<vn-vertical class="input vn-pt-md">
|
||||
<vn-datalist vn-one
|
||||
<vn-textfield vn-one
|
||||
vn-id="search"
|
||||
data="$ctrl.tagValues"
|
||||
ng-keyUp="$ctrl.onSearchByTag($event)"
|
||||
show-field="value"
|
||||
value-field="value"
|
||||
label="Search tag">
|
||||
<prepend>
|
||||
<vn-icon icon="search"></vn-icon>
|
||||
|
@ -100,14 +97,15 @@
|
|||
style="cursor: pointer;">
|
||||
</vn-icon>
|
||||
</append>
|
||||
</vn-datalist>
|
||||
</vn-textfield>
|
||||
</vn-vertical>
|
||||
<vn-popover
|
||||
vn-id="popover"
|
||||
on-close="$ctrl.onPopoverClose()">
|
||||
<vn-order-catalog-search-panel
|
||||
on-submit="$ctrl.onPanelSubmit($filter)"
|
||||
popover="popover">
|
||||
popover="popover"
|
||||
result-tags="$ctrl.resultTags">
|
||||
</vn-order-catalog-search-panel>
|
||||
</vn-popover>
|
||||
<div class="chips">
|
||||
|
|
|
@ -68,8 +68,8 @@ class Controller extends Section {
|
|||
|
||||
if (!value) return;
|
||||
|
||||
this.buildTagsFilter(value);
|
||||
this.buildOrderFilter(value);
|
||||
this.fetchResultTags(value);
|
||||
this.buildOrderFilter();
|
||||
}
|
||||
|
||||
get categoryId() {
|
||||
|
@ -300,43 +300,29 @@ class Controller extends Section {
|
|||
return tagGroups;
|
||||
}
|
||||
|
||||
buildTagsFilter(items) {
|
||||
const tagValues = [];
|
||||
items.forEach(item => {
|
||||
item.tags.forEach(itemTag => {
|
||||
const alreadyAdded = tagValues.findIndex(tag => {
|
||||
return tag.value == itemTag.value;
|
||||
fetchResultTags(items) {
|
||||
const resultTags = [];
|
||||
for (let item of items) {
|
||||
for (let itemTag of item.tags) {
|
||||
const alreadyAdded = resultTags.findIndex(tag => {
|
||||
return tag.tagFk == itemTag.tagFk;
|
||||
});
|
||||
|
||||
if (alreadyAdded == -1)
|
||||
tagValues.push(itemTag);
|
||||
});
|
||||
});
|
||||
this.tagValues = tagValues;
|
||||
resultTags.push({...itemTag, priority: 1});
|
||||
else
|
||||
resultTags[alreadyAdded].priority += 1;
|
||||
}
|
||||
}
|
||||
this.resultTags = resultTags;
|
||||
}
|
||||
|
||||
buildOrderFilter(items) {
|
||||
const tags = [];
|
||||
items.forEach(item => {
|
||||
item.tags.forEach(itemTag => {
|
||||
const alreadyAdded = tags.findIndex(tag => {
|
||||
return tag.field == itemTag.tagFk;
|
||||
});
|
||||
buildOrderFilter() {
|
||||
const filter = [].concat(this.defaultOrderFields);
|
||||
for (let tag of this.resultTags)
|
||||
filter.push({...tag, field: tag.id, isTag: true});
|
||||
|
||||
if (alreadyAdded == -1) {
|
||||
tags.push({
|
||||
name: itemTag.name,
|
||||
field: itemTag.tagFk,
|
||||
isTag: true,
|
||||
priority: 1
|
||||
});
|
||||
} else
|
||||
tags[alreadyAdded].priority += 1;
|
||||
});
|
||||
});
|
||||
let newFilterList = [].concat(this.defaultOrderFields);
|
||||
newFilterList = newFilterList.concat(tags);
|
||||
this.orderFields = newFilterList;
|
||||
this.orderFields = filter;
|
||||
}
|
||||
|
||||
onSearch(params) {
|
||||
|
|
Loading…
Reference in New Issue