This commit is contained in:
2020-02-19 17:45:57 +00:00
parent 41206a1299
commit 1903a4da6d
2 changed files with 52 additions and 38 deletions

View File

@@ -159,7 +159,8 @@ export default {
"PM", "PM",
"DataListView", "DataListView",
"FilterUnsaved", "FilterUnsaved",
"Include" "Include",
"AnyUser"
], ],
//////////////////////////////////////////////////////// ////////////////////////////////////////////////////////

View File

@@ -49,23 +49,33 @@
> >
</v-col> </v-col>
<v-col cols="12"> <v-col cols="12">
<v-col cols="12" sm="6" lg="4" xl="3"> <v-row>
<v-text-field <v-col cols="12" sm="6" lg="4" xl="3">
v-model="objName" <v-text-field
:readonly="this.formState.readOnly" v-model="objName"
clearable :readonly="this.formState.readOnly"
@click:clear="onChange('name')" clearable
:counter="255" @click:clear="onChange('name')"
:label="lt('WidgetName')" :counter="255"
:rules="[ :label="lt('WidgetName')"
form().max255(this, 'name'), :rules="[
form().required(this, 'name') form().max255(this, 'name'),
]" form().required(this, 'name')
:error-messages="form().serverErrors(this, 'name')" ]"
ref="name" :error-messages="form().serverErrors(this, 'name')"
@change="onChange('name')" ref="name"
></v-text-field> @change="onChange('name')"
</v-col> ></v-text-field>
</v-col>
<v-col cols="12" sm="6" lg="4" xl="3">
<v-checkbox
v-model="objPublic"
:readonly="this.formState.readOnly"
:label="lt('AnyUser')"
ref="public"
></v-checkbox>
</v-col>
</v-row>
</v-col> </v-col>
<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>
@@ -448,7 +458,7 @@ function setEffectiveListView(vm) {
- If listviewid is zero then that's starting with the default list view so need to fetch it and then init the form - If listviewid is zero then that's starting with the default list view so need to fetch it and then init the form
- If listviewid is -1 then that's starting with an unsaved listview so get that from the saved form store - If listviewid is -1 then that's starting with an unsaved listview so get that from the saved form store
- If listviewid is greater than 0 then it's a saved listview and there sb a cached version of it but ideally maybe fetch it from - If listviewid is greater than 0 then it's a saved listview and there sb a cached version of it but ideally maybe fetch it from
objPublic, objName
*/ */
if (vm.listViewId == null) { if (vm.listViewId == null) {
@@ -460,6 +470,7 @@ function setEffectiveListView(vm) {
if (vm.listViewId == -1) { if (vm.listViewId == -1) {
if (formSettings.saved.dataTable.editedListView != null) { if (formSettings.saved.dataTable.editedListView != null) {
vm.effectiveListView = formSettings.saved.dataTable.editedListView; vm.effectiveListView = formSettings.saved.dataTable.editedListView;
vm.objName = vm.lt("FilterUnsaved");
//console.log("DONE setEffectiveListView (resolved with saved, lvid=-1)"); //console.log("DONE setEffectiveListView (resolved with saved, lvid=-1)");
return Promise.resolve(); return Promise.resolve();
} }
@@ -473,30 +484,32 @@ function setEffectiveListView(vm) {
throw res.error; throw res.error;
} else { } else {
vm.effectiveListView = JSON.parse(res.data); vm.effectiveListView = JSON.parse(res.data);
vm.objName = vm.lt("FilterUnsaved");
//console.log("DONE setEffectiveListView (fetched default, lvid=0)"); //console.log("DONE setEffectiveListView (fetched default, lvid=0)");
} }
}); });
} else { } else {
//listview has an id value //listview has an id value
//check if cached, if not then fetch, cache and set //fetch, cache and set
if ( // if (
formSettings.temp.dataTable && // formSettings.temp.dataTable &&
formSettings.temp.dataTable.cachedListView != null // formSettings.temp.dataTable.cachedListView != null
) { // ) {
vm.effectiveListView = formSettings.temp.dataTable.cachedListView; // vm.effectiveListView = formSettings.temp.dataTable.cachedListView;
//console.log("DONE setEffectiveListView (resolved with cached,lvid>0)"); // //console.log("DONE setEffectiveListView (resolved with cached,lvid>0)");
return Promise.resolve(); // return Promise.resolve();
} else { // } else {
//fetch it and cache it //fetch it and cache it
return window.$gz.api.get("DataListView/" + vm.listViewId).then(res => { return window.$gz.api.get("DataListView/" + vm.listViewId).then(res => {
if (res.error != undefined) { if (res.error != undefined) {
throw res.error; throw res.error;
} else { } else {
vm.effectiveListView = JSON.parse(res.data.listView); vm.effectiveListView = JSON.parse(res.data.listView);
//console.log("DONE setEffectiveListView (fetched listView, lvid>0)"); vm.objPublic = res.data.public;
} vm.objName = res.data.name;
}); //console.log("DONE setEffectiveListView (fetched listView, lvid>0)");
} }
});
} }
} }