This commit is contained in:
2019-06-20 23:54:53 +00:00
parent 0dfcc94862
commit b9adf7fea8
3 changed files with 249 additions and 49 deletions

View File

@@ -152,7 +152,15 @@
</v-flex>
<v-flex xs12 px-2>
<v-autocomplete
<gz-tag-picker
:label="this.$gzlocale.get('Tags')"
v-model="obj.tags"
:readonly="this.formState.readOnly"
ref="tags"
:error-messages="this.$gzform.serverErrors(this, 'tags')"
@change="onChange('tags')"
></gz-tag-picker>
<!-- <v-autocomplete
v-model="obj.tags"
:readonly="this.formState.readOnly"
:label="this.$gzlocale.get('Tags')"
@@ -187,16 +195,12 @@
</v-layout>
</v-container>
</template>
</v-autocomplete>
</v-autocomplete> -->
</v-flex>
</v-layout>
<!-- <v-layout align-left justify-center row wrap mt-5>
<v-flex xs6 sm4>
tags: {{ obj.tags }}
<br />
TagPickList: {{ pickLists.tags }}
</v-flex>
</v-layout> -->
<v-layout align-left justify-center row wrap mt-5>
<v-flex xs6 sm4> FORMtags: {{ obj.tags }} </v-flex>
</v-layout>
<!-- <v-layout align-left justify-center row wrap mt-5>
<v-flex xs6 sm4>
READY: {{ formState.ready }}
@@ -218,7 +222,7 @@
<script>
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* eslint-disable */
/* Xeslint-disable */
////////////////////////////////////////////////////////////////////////////////////////////////////////////
const FORM_KEY = "inventory-widget-edit";
@@ -301,11 +305,8 @@ export default {
data() {
return {
pickLists: {
roles: [],
tags: [""]
roles: []
},
tagSearchEntry: null,
tagSearchUnderway: false,
obj: {
id: 0,
concurrencyToken: 0,
@@ -360,29 +361,29 @@ export default {
}
},
deep: true
},
tagSearchEntry(val) {
var vm = this;
if (vm.tagSearchUnderway) {
return;
}
vm.tagSearchUnderway = true;
vm.$gzapi
.get("TagList/picklist?query=" + val) //roles
.then(res => {
if (res.error) {
throw res.error;
}
//adding this to the property will automatically have it cached by the autocomplete component
//as cache-items has been set so this just needs to be set here once and all is well in future
//Any search will be kept for later so this is very efficient
vm.pickLists.tags = res.data;
vm.tagSearchUnderway = false;
})
.catch(err => {
vm.$gzHandleFormError(err);
});
}
// tagSearchEntry(val) {
// var vm = this;
// if (vm.tagSearchUnderway) {
// return;
// }
// vm.tagSearchUnderway = true;
// vm.$gzapi
// .get("TagList/picklist?query=" + val) //roles
// .then(res => {
// if (res.error) {
// throw res.error;
// }
// //adding this to the property will automatically have it cached by the autocomplete component
// //as cache-items has been set so this just needs to be set here once and all is well in future
// //Any search will be kept for later so this is very efficient
// vm.pickLists.tags = res.data;
// vm.tagSearchUnderway = false;
// })
// .catch(err => {
// vm.$gzHandleFormError(err);
// });
// }
},
computed: {
canSave: function() {
@@ -426,7 +427,7 @@ export default {
} else {
vm.obj = res.data;
//Populate tags pick list, this is required to cache it at least once and display it when form opens
vm.pickLists.tags = res.data.tags;
// vm.pickLists.tags = res.data.tags;
//Update the form status
vm.$gzform.setFormState({
@@ -561,19 +562,20 @@ export default {
vm.$gzHandleFormError(error, vm);
});
}
},
addTag() {
var theTag = this.tagSearchEntry;
theTag = this.$gzutil.normalizeTag(theTag);
//make sure there are no existing of the same tag?
this.pickLists.tags.push(theTag);
this.obj.tags.push(theTag);
this.tagSearchEntry = "";
this.$gzform.setFormState({
vm: this,
dirty: true
});
}
// ,
// addTag() {
// var theTag = this.tagSearchEntry;
// theTag = this.$gzutil.normalizeTag(theTag);
// //make sure there are no existing of the same tag?
// this.pickLists.tags.push(theTag);
// this.obj.tags.push(theTag);
// this.tagSearchEntry = "";
// this.$gzform.setFormState({
// vm: this,
// dirty: true
// });
// }
}
};