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