This commit is contained in:
@@ -45,7 +45,7 @@
|
||||
large
|
||||
block
|
||||
v-if="editItem.tempFilterToken != null"
|
||||
@click="addFilterCondition(item)"
|
||||
@click="addFilterCondition(editItem)"
|
||||
><v-icon large>$ayiPlus</v-icon></v-btn
|
||||
>
|
||||
</div>
|
||||
@@ -80,7 +80,7 @@
|
||||
large
|
||||
block
|
||||
v-if="editItem.tempFilterOperator != null"
|
||||
@click="addFilterCondition(item)"
|
||||
@click="addFilterCondition(editItem)"
|
||||
><v-icon large>$ayiPlus</v-icon></v-btn
|
||||
>
|
||||
</div>
|
||||
@@ -115,7 +115,7 @@
|
||||
large
|
||||
block
|
||||
v-if="editItem.tempFilterOperator != null"
|
||||
@click="addFilterCondition(item)"
|
||||
@click="addFilterCondition(editItem)"
|
||||
><v-icon large>$ayiPlus</v-icon></v-btn
|
||||
>
|
||||
</div>
|
||||
@@ -146,7 +146,7 @@
|
||||
large
|
||||
block
|
||||
v-if="editItem.tempFilterOperator != null"
|
||||
@click="addFilterCondition(item)"
|
||||
@click="addFilterCondition(editItem)"
|
||||
><v-icon large>$ayiPlus</v-icon></v-btn
|
||||
>
|
||||
</div>
|
||||
@@ -174,7 +174,7 @@
|
||||
large
|
||||
block
|
||||
v-if="editItem.tempFilterOperator != null"
|
||||
@click="addFilterCondition(item)"
|
||||
@click="addFilterCondition(editItem)"
|
||||
><v-icon large>$ayiPlus</v-icon></v-btn
|
||||
>
|
||||
</div>
|
||||
@@ -201,7 +201,7 @@
|
||||
large
|
||||
block
|
||||
v-if="editItem.tempFilterOperator != null"
|
||||
@click="addFilterCondition(item)"
|
||||
@click="addFilterCondition(editItem)"
|
||||
><v-icon large>$ayiPlus</v-icon></v-btn
|
||||
>
|
||||
</div>
|
||||
@@ -225,7 +225,7 @@
|
||||
large
|
||||
block
|
||||
v-if="editItem.tempFilterOperator != null"
|
||||
@click="addFilterCondition(item)"
|
||||
@click="addFilterCondition(editItem)"
|
||||
><v-icon large>$ayiPlus</v-icon></v-btn
|
||||
>
|
||||
</div>
|
||||
@@ -256,7 +256,7 @@
|
||||
large
|
||||
block
|
||||
v-if="editItem.tempFilterOperator != null"
|
||||
@click="addFilterCondition(item)"
|
||||
@click="addFilterCondition(editItem)"
|
||||
><v-icon large>$ayiPlus</v-icon></v-btn
|
||||
>
|
||||
</div>
|
||||
@@ -345,6 +345,101 @@ export default {
|
||||
dataListKey: String
|
||||
},
|
||||
methods: {
|
||||
addFilterCondition(editItem) {
|
||||
// filter:[{column:"PartPartNumber",any:true/false,items:[{op: "=",value: "400735"}]}],
|
||||
let filterItem = { op: null, value: null, display: null };
|
||||
let filterItemSet = false;
|
||||
|
||||
//DATE relative token?
|
||||
if (editItem.uiFieldDataType === 1) {
|
||||
if (editItem.tempFilterToken) {
|
||||
//no or has value?
|
||||
|
||||
//this redundancy is because there are two ways to select the no value and has value; both present in the relative pick list
|
||||
//and also in the select specific value picklist as the date filter picker for convenience so this is a workaround
|
||||
//to simulate if the user had done the full *select* first then picked novalue or has value
|
||||
|
||||
if (editItem.tempFilterToken == "*NOVALUE*") {
|
||||
filterItem.op = "=";
|
||||
filterItem.value = "*NULL*";
|
||||
filterItemSet = true;
|
||||
} else if (editItem.tempFilterToken == "*HASVALUE*") {
|
||||
filterItem.op = "!=";
|
||||
filterItem.value = "*NULL*";
|
||||
filterItemSet = true;
|
||||
} else {
|
||||
//some kind of relative date token?
|
||||
if (editItem.tempFilterToken != "*select*") {
|
||||
//special relative token
|
||||
filterItem.op = "="; //equality
|
||||
filterItem.token = true;
|
||||
filterItem.value = editItem.tempFilterToken;
|
||||
filterItemSet = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//BLANKS / NONBLANKS TOKENS?
|
||||
if (false == filterItemSet && editItem.tempFilterOperator == "*NOVALUE*") {
|
||||
filterItem.op = "=";
|
||||
filterItem.value = "*NULL*";
|
||||
filterItemSet = true;
|
||||
}
|
||||
|
||||
if (false == filterItemSet && editItem.tempFilterOperator == "*HASVALUE*") {
|
||||
filterItem.op = "!=";
|
||||
filterItem.value = "*NULL*";
|
||||
filterItemSet = true;
|
||||
}
|
||||
|
||||
//JUST REGULAR FILTER ITEM
|
||||
if (
|
||||
false == filterItemSet &&
|
||||
editItem.tempFilterOperator &&
|
||||
editItem.tempFilterValue != null
|
||||
) {
|
||||
filterItem.op = editItem.tempFilterOperator;
|
||||
filterItem.value = editItem.tempFilterValue;
|
||||
//only add if there is both an op and a value
|
||||
//above here for tokens that isn't a restriction but
|
||||
//after passing through those conditions were at a point where there MUST be both
|
||||
if (filterItem.op && filterItem.value != null) {
|
||||
filterItemSet = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (filterItemSet) {
|
||||
//display
|
||||
filterItem.display = getDisplayForFilter(
|
||||
this,
|
||||
editItem.uiFieldDataType,
|
||||
filterItem.op,
|
||||
filterItem.value,
|
||||
editItem.enumType
|
||||
);
|
||||
|
||||
//add only if not already in the collection (accidental double click)
|
||||
//de-lodash
|
||||
// if (!window.$gz. _.find(editItem.filter.items, filterItem)) {
|
||||
|
||||
//some fits better here as it only test for truthiness and returns immediately on true
|
||||
//also the item is unique and display doesn't need to be compared for equality it's irrelevant
|
||||
//so only the op and the value need to be checked
|
||||
if (
|
||||
!editItem.filter.items.some(
|
||||
z => z.op == filterItem.op && z.value == filterItem.value
|
||||
)
|
||||
) {
|
||||
editItem.filter.items.push(filterItem);
|
||||
window.$gz.form.setFormState({
|
||||
vm: this,
|
||||
dirty: true
|
||||
});
|
||||
}
|
||||
return;
|
||||
}
|
||||
},
|
||||
open(tableColumnData) {
|
||||
this.tableColumnData = tableColumnData;
|
||||
initEditItem(this);
|
||||
|
||||
Reference in New Issue
Block a user