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",
"DataListView",
"FilterUnsaved",
"Include"
"Include",
"AnyUser"
],
////////////////////////////////////////////////////////

View File

@@ -49,23 +49,33 @@
>
</v-col>
<v-col cols="12">
<v-col cols="12" sm="6" lg="4" xl="3">
<v-text-field
v-model="objName"
:readonly="this.formState.readOnly"
clearable
@click:clear="onChange('name')"
:counter="255"
:label="lt('WidgetName')"
:rules="[
form().max255(this, 'name'),
form().required(this, 'name')
]"
:error-messages="form().serverErrors(this, 'name')"
ref="name"
@change="onChange('name')"
></v-text-field>
</v-col>
<v-row>
<v-col cols="12" sm="6" lg="4" xl="3">
<v-text-field
v-model="objName"
:readonly="this.formState.readOnly"
clearable
@click:clear="onChange('name')"
:counter="255"
:label="lt('WidgetName')"
:rules="[
form().max255(this, 'name'),
form().required(this, 'name')
]"
:error-messages="form().serverErrors(this, 'name')"
ref="name"
@change="onChange('name')"
></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>
<template v-for="item in obj">
<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 -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
objPublic, objName
*/
if (vm.listViewId == null) {
@@ -460,6 +470,7 @@ function setEffectiveListView(vm) {
if (vm.listViewId == -1) {
if (formSettings.saved.dataTable.editedListView != null) {
vm.effectiveListView = formSettings.saved.dataTable.editedListView;
vm.objName = vm.lt("FilterUnsaved");
//console.log("DONE setEffectiveListView (resolved with saved, lvid=-1)");
return Promise.resolve();
}
@@ -473,30 +484,32 @@ function setEffectiveListView(vm) {
throw res.error;
} else {
vm.effectiveListView = JSON.parse(res.data);
vm.objName = vm.lt("FilterUnsaved");
//console.log("DONE setEffectiveListView (fetched default, lvid=0)");
}
});
} else {
//listview has an id value
//check if cached, if not then fetch, cache and set
if (
formSettings.temp.dataTable &&
formSettings.temp.dataTable.cachedListView != null
) {
vm.effectiveListView = formSettings.temp.dataTable.cachedListView;
//console.log("DONE setEffectiveListView (resolved with cached,lvid>0)");
return Promise.resolve();
} else {
//fetch it and cache it
return window.$gz.api.get("DataListView/" + vm.listViewId).then(res => {
if (res.error != undefined) {
throw res.error;
} else {
vm.effectiveListView = JSON.parse(res.data.listView);
//console.log("DONE setEffectiveListView (fetched listView, lvid>0)");
}
});
}
//fetch, cache and set
// if (
// formSettings.temp.dataTable &&
// formSettings.temp.dataTable.cachedListView != null
// ) {
// vm.effectiveListView = formSettings.temp.dataTable.cachedListView;
// //console.log("DONE setEffectiveListView (resolved with cached,lvid>0)");
// return Promise.resolve();
// } else {
//fetch it and cache it
return window.$gz.api.get("DataListView/" + vm.listViewId).then(res => {
if (res.error != undefined) {
throw res.error;
} else {
vm.effectiveListView = JSON.parse(res.data.listView);
vm.objPublic = res.data.public;
vm.objName = res.data.name;
//console.log("DONE setEffectiveListView (fetched listView, lvid>0)");
}
});
}
}