This commit is contained in:
2020-04-07 19:29:56 +00:00
parent 1f677e6a77
commit e9556b1777

View File

@@ -26,7 +26,9 @@
</v-col>
<v-col cols="12">
results list
totalresults:{{ totalResults }}
<div>results:{{ results }}</div>
</v-col>
</v-row>
</v-form>
@@ -96,6 +98,8 @@ export default {
},
searchPhrase: null,
searchObjectType: null,
results: [],
totalResults: null,
formState: {
ready: false,
dirty: false,
@@ -114,42 +118,39 @@ export default {
getDataFromApi() {
let vm = this;
vm.formState.loading = true;
//always fetch on this form for the current logged in user id
let url = API_BASE_URL + vm.$store.state.userId;
window.$gz.form.deleteAllErrorBoxErrors(vm);
/**
* {
"phrase": "e*",
"nameOnly": false,
"typeOnly": 0,
"maxResults": 100
}
*
*/
window.$gz.api
.get(url)
.upsert(API_BASE_URL, {
phrase: vm.searchPhrase,
nameOnly: false,
typeOnly: !!vm.searchObjectType ? vm.searchObjectType : 0,
maxResults: 200
})
.then(res => {
if (res.error != undefined) {
//Not found?
if (res.error.code == "2010") {
//notify not found error then navigate backwards
window.$gz.eventBus.$emit(
"notify-error",
vm.$ay.t("ErrorAPI2010")
);
// navigate backwards
window.$gz._.delay(function() {
vm.$router.go(-1);
}, 2000);
}
vm.formState.serverError = res.error;
window.$gz.form.setErrorBoxErrors(vm);
} else {
vm.obj = res.data;
vm.results = res.data.searchResults;
vm.totalResults = res.data.totalResultsFound;
//Update the form status
window.$gz.form.setFormState({
vm: vm,
dirty: false,
valid: true,
loading: false,
readOnly: res.readOnly ? true : false
loading: false
});
//modify the menu as necessary
generateMenu(vm);
//generateMenu(vm);
}
})
.catch(function handleGetDataFromAPIError(error) {
@@ -224,14 +225,8 @@ function initForm(vm) {
//
function fetchTranslatedText(vm) {
return window.$gz.translation.fetch([
//needs all object types
"CurrencyCode",
"LanguageCode",
"TimeZone",
"UserEmailAddress",
"Hour12",
"UserColor",
"Translation"
//todo: needs all object types
"Search"
]);
}
@@ -239,8 +234,7 @@ function fetchTranslatedText(vm) {
//
//
function populateSelectionLists(vm) {
//http://localhost:7575/api/v8/Translation/List
return window.$gz.api.get("Translation/List").then(res => {
return window.$gz.api.get("EnumList/List/Core").then(res => {
if (res.error != undefined) {
window.$gz.errorHandler.handleFormError(res.error, vm);
} else {