This commit is contained in:
2020-02-19 17:36:45 +00:00
parent 73f664a153
commit 41206a1299
2 changed files with 63 additions and 5 deletions

View File

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

View File

@@ -48,6 +48,25 @@
>{{ formState.errorBoxMessage }}</v-alert
>
</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-col>
<template v-for="item in obj">
<v-col :key="item.key" cols="12" sm="6" lg="4" xl="3" px-2>
<v-card>
@@ -60,7 +79,7 @@
<v-card-text>
<v-checkbox
v-model="item.include"
:label="lt('INCLUDE')"
:label="lt('Include')"
:ref="item.key"
@change="includeChanged(item)"
></v-checkbox>
@@ -149,6 +168,8 @@ export default {
data() {
return {
obj: [], //working copy driving UI
objName: "",
objPublic: true,
listViewId: undefined,
dataListKey: undefined,
formKey: undefined,
@@ -169,7 +190,14 @@ export default {
rights: window.$gz.role.getRights(window.$gz.type.DataListView)
};
},
computed: {
canSave: function() {
return this.formState.valid && this.formState.dirty;
},
canDuplicate: function() {
return this.formState.valid && !this.formState.dirty;
}
},
methods: {
lt: function(ltkey) {
return window.$gz.locale.get(ltkey);
@@ -182,6 +210,14 @@ export default {
this.formState.dirty = true;
enableSaveButton();
},
form() {
return window.$gz.form;
},
onChange(ref) {
if (!this.formState.loading && !this.formState.readOnly) {
window.$gz.form.onChange(this, ref);
}
},
submit() {
var vm = this;
var url = API_BASE_URL + this.formCustomTemplateKey;
@@ -282,7 +318,12 @@ function clickHandler(menuItem) {
case "save":
m.vm.submit();
break;
case "delete":
m.vm.remove();
break;
case "duplicate":
m.vm.duplicate();
break;
default:
window.$gz.eventBus.$emit(
"notify-warning",
@@ -318,7 +359,23 @@ function generateMenu(vm) {
vm: vm
});
}
if (vm.rights.delete) {
menuOptions.menuItems.push({
title: window.$gz.locale.get("Delete"),
icon: "trash-alt",
surface: true,
key: FORM_KEY + ":delete",
vm: vm
});
}
if (vm.rights.change) {
menuOptions.menuItems.push({
title: window.$gz.locale.get("Duplicate"),
icon: "clone",
key: FORM_KEY + ":duplicate",
vm: vm
});
}
window.$gz.eventBus.$emit("menu-change", menuOptions);
}