This commit is contained in:
@@ -31,8 +31,6 @@ todo: biz rule like validatecansave and validatecandelete but validatecanFetch f
|
||||
currently doing: MEMO -
|
||||
|
||||
|
||||
READ menu items
|
||||
Reply, Forward
|
||||
compose - must filter OUT outside users, currently they show, new picklist I guess with extra criteria?
|
||||
search results should not pull up other's memo's
|
||||
exclude from searching? Not searchable??
|
||||
|
||||
@@ -37,10 +37,9 @@
|
||||
</template>
|
||||
<script>
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/* eslint-disable */
|
||||
/* Xeslint-disable */
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
export default {
|
||||
created() {
|
||||
this.fetchValueIfNotPresent();
|
||||
@@ -76,13 +75,17 @@ export default {
|
||||
showEditIcon: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
},
|
||||
allowNoSelection: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
canClear:{type: Boolean, default: true},
|
||||
label: { type: String, default: "" }
|
||||
canClear: { type: Boolean, default: true },
|
||||
label: { type: String, default: "" },
|
||||
variant: {
|
||||
type: String,
|
||||
default: null
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
ayaType(val, oldVal) {
|
||||
@@ -161,20 +164,19 @@ export default {
|
||||
type: this.ayaType,
|
||||
id: idToOpen
|
||||
});
|
||||
},
|
||||
selectionMade(e) {
|
||||
this.clearErrors();
|
||||
if (e == undefined) {
|
||||
},
|
||||
selectionMade(e) {
|
||||
this.clearErrors();
|
||||
if (e == undefined) {
|
||||
//this will happen when clear clicked
|
||||
//simulate empty selection:
|
||||
e = window.$gz.form.getNoSelectionItem(true);
|
||||
e = window.$gz.form.getNoSelectionItem(true);
|
||||
}
|
||||
|
||||
this.lastSelection = e;
|
||||
|
||||
this.lastSelection = e;
|
||||
|
||||
//this is required for the control to update and parent form to detect it
|
||||
this.$emit("input", e.id);
|
||||
|
||||
this.$emit("input", e.id);
|
||||
},
|
||||
fetchValueIfNotPresent() {
|
||||
//is there a value that might require fetching?
|
||||
@@ -195,7 +197,12 @@ export default {
|
||||
window.$gz.form.addNoSelectionItem(vm.searchResults, true);
|
||||
} else {
|
||||
//Not here, better get it
|
||||
let urlParams = "?ayaType=" + vm.ayaType + "&preId=" + vm.value;
|
||||
let variantSegment = "";
|
||||
if (vm.variant != null) {
|
||||
variantSegment = `&variant=${vm.variant}`;
|
||||
}
|
||||
let urlParams =
|
||||
"?ayaType=" + vm.ayaType + "&preId=" + vm.value + variantSegment;
|
||||
vm.getList(urlParams);
|
||||
}
|
||||
},
|
||||
@@ -270,18 +277,21 @@ export default {
|
||||
if (vm.includeInactive) {
|
||||
urlParams += "&inactive=true";
|
||||
}
|
||||
if (vm.variant != null) {
|
||||
urlParams += `&variant=${vm.variant}`;
|
||||
}
|
||||
}
|
||||
try {
|
||||
let res = await window.$gz.api.get("pick-list/list" + urlParams);
|
||||
|
||||
vm.fetching = false;
|
||||
//We never expect there to be no data here
|
||||
if (!res.hasOwnProperty("data")) {
|
||||
return Promise.reject(res);
|
||||
if (!res.hasOwnProperty("data")) {
|
||||
return Promise.reject(res);
|
||||
}
|
||||
vm.searchResults = res.data;
|
||||
if(vm.allowNoSelection){
|
||||
window.$gz.form.addNoSelectionItem(vm.searchResults, true);
|
||||
if (vm.allowNoSelection) {
|
||||
window.$gz.form.addNoSelectionItem(vm.searchResults, true);
|
||||
}
|
||||
vm.replaceLastSelection();
|
||||
} catch (err) {
|
||||
@@ -293,7 +303,7 @@ export default {
|
||||
//NOTE debounce with a watcher is a bit different, currently it has to be done exactly this way, nothing else will work properly
|
||||
//https://vuejs.org/v2/guide/migration.html#debounce-Param-Attribute-for-v-model-removed
|
||||
//-----------------
|
||||
|
||||
|
||||
let vm = this;
|
||||
let isATwoTermQuery = false;
|
||||
let queryTerms = [];
|
||||
@@ -342,8 +352,8 @@ export default {
|
||||
//check that both terms aren't tags
|
||||
if (
|
||||
//note: de-lodashed here not sure if I need to add a null check or not
|
||||
queryTerms[0].startsWith("..") &&
|
||||
queryTerms[1].startsWith("..")
|
||||
queryTerms[0].startsWith("..") &&
|
||||
queryTerms[1].startsWith("..")
|
||||
) {
|
||||
vm.errors.push(vm.$ay.t("ErrorPickListQueryInvalid"));
|
||||
return;
|
||||
@@ -373,6 +383,9 @@ export default {
|
||||
if (vm.includeInactive) {
|
||||
urlParams += "&inactive=true";
|
||||
}
|
||||
if (vm.variant != null) {
|
||||
urlParams += `&variant=${vm.variant}`;
|
||||
}
|
||||
this.getList(urlParams);
|
||||
//------------
|
||||
}, 300) //did some checking, 200-300ms seems to be the most common debounce time for ajax search queries
|
||||
@@ -383,13 +396,14 @@ export default {
|
||||
function debounce(func, wait, immediate) {
|
||||
var timeout;
|
||||
return function() {
|
||||
var context = this, args = arguments;
|
||||
clearTimeout(timeout);
|
||||
timeout = setTimeout(function() {
|
||||
timeout = null;
|
||||
if (!immediate) func.apply(context, args);
|
||||
}, wait);
|
||||
if (immediate && !timeout) func.apply(context, args);
|
||||
var context = this,
|
||||
args = arguments;
|
||||
clearTimeout(timeout);
|
||||
timeout = setTimeout(function() {
|
||||
timeout = null;
|
||||
if (!immediate) func.apply(context, args);
|
||||
}, wait);
|
||||
if (immediate && !timeout) func.apply(context, args);
|
||||
};
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -72,6 +72,7 @@
|
||||
:allowNoSelection="false"
|
||||
:canClear="false"
|
||||
:ayaType="ayaTypes().User"
|
||||
:variant="'outside'"
|
||||
:showEditIcon="false"
|
||||
v-model="pickListSelectedUserId"
|
||||
:label="$ay.t('MemoToID')"
|
||||
|
||||
Reference in New Issue
Block a user