This commit is contained in:
2020-03-28 19:52:26 +00:00
parent c559d09cd0
commit 78e1527f0d

View File

@@ -27,7 +27,11 @@
> >
</v-select> </v-select>
</v-col> </v-col>
template:
{{ obj }} {{ obj }}
available fields:
{{ availableFields }}
<!-- <template v-for="item in obj"> <!-- <template v-for="item in obj">
<v-col :key="item.key" cols="12" sm="6" lg="4" xl="3" px-2> <v-col :key="item.key" cols="12" sm="6" lg="4" xl="3" px-2>
<v-card> <v-card>
@@ -130,6 +134,7 @@ export default {
selectLists: { selectLists: {
pickListTemplates: [] pickListTemplates: []
}, },
availableFields: [],
templateId: 0, templateId: 0,
formState: { formState: {
ready: false, ready: false,
@@ -165,29 +170,40 @@ export default {
if (!vm.templateId || vm.templateId == 0) { if (!vm.templateId || vm.templateId == 0) {
return; return;
} }
var url = API_BASE_URL + vm.templateId;
window.$gz.form.deleteAllErrorBoxErrors(vm); window.$gz.form.deleteAllErrorBoxErrors(vm);
//get available fields
window.$gz.api window.$gz.api
.get(url) .get(API_BASE_URL + "ListFields/" + vm.templateId)
.then(res => { .then(res => {
if (res.error != undefined) { if (res.error != undefined) {
vm.formState.serverError = res.error; vm.formState.serverError = res.error;
window.$gz.form.setErrorBoxErrors(vm); window.$gz.form.setErrorBoxErrors(vm);
} else { } else {
vm.obj = res.data; vm.availableFields = res.data;
//Update the form status
window.$gz.form.setFormState({
vm: vm,
dirty: false,
valid: true,
loading: false,
readOnly: res.readOnly ? true : false
});
} }
}) })
.then(
//get current edited template
window.$gz.api.get(API_BASE_URL + vm.templateId).then(res => {
if (res.error != undefined) {
vm.formState.serverError = res.error;
window.$gz.form.setErrorBoxErrors(vm);
} else {
vm.obj = res.data;
//Update the form status
window.$gz.form.setFormState({
vm: vm,
dirty: false,
valid: true,
loading: false,
readOnly: res.readOnly ? true : false
});
}
})
)
.catch(function handleGetDataFromAPIError(error) { .catch(function handleGetDataFromAPIError(error) {
//Update the form status //Update the form status
window.$gz.form.setFormState({ window.$gz.form.setFormState({