This commit is contained in:
2020-07-27 20:55:54 +00:00
parent b6f9f4a05d
commit 14bf31b841

View File

@@ -13,6 +13,7 @@
v-model="userId"
:label="$ay.t('UserList')"
ref="userPickList"
@input="checkSave()"
></gz-pick-list> </v-col
><v-col cols="1">
<v-btn @click="addSelected()">
@@ -20,18 +21,6 @@
</v-btn>
</v-col>
</v-row>
<!-- <v-col cols="12">
<v-select
:items="items"
item-text="name"
item-value="id"
multiple
chips
deletable-chips
:value="toUsers"
:label="$ay.t('MemoToID')"
></v-select>
</v-col> -->
<v-col cols="12">
<template v-for="item in toUsers">
@@ -55,6 +44,7 @@
ref="message"
auto-grow
:clearable="!formState.readOnly"
@input="checkSave()"
></v-textarea>
</v-col>
</v-row>
@@ -155,6 +145,18 @@ export default {
}
},
methods: {
checkSave() {
let hasSelection =
this.toUsers.length > 0 || (this.userId != null && this.userId != 0);
let hasText = this.message != null && this.message != "";
this.formState.dirty = hasSelection && hasText;
if (this.canSave) {
window.$gz.eventBus.$emit("menu-enable-item", FORM_KEY + ":save");
} else {
window.$gz.eventBus.$emit("menu-disable-item", FORM_KEY + ":save");
}
},
closeChip(item) {
// console.log(item);
// debugger;
@@ -162,22 +164,21 @@ export default {
if (i != -1) {
this.toUsers.splice(i, 1);
}
this.checkSave();
},
addSelected() {
let selected = this.$refs.userPickList.getFullSelectionValue();
if (selected == null) {
console.log("Selected is null");
return;
}
//already in the list?
if (this.toUsers.find(z => z.id == selected.id)) {
console.log(`User ${selected.name} is already in the list`);
return;
}
console.log(`Pushing user ${selected.name} into list`);
this.toUsers.push(selected);
this.userId = 0;
this.checkSave();
},
ayaTypes: function() {
return window.$gz.type;
@@ -186,11 +187,7 @@ export default {
form() {
return window.$gz.form;
},
fieldValueChanged(ref) {
if (!this.formState.loading && !this.formState.readOnly) {
window.$gz.form.fieldValueChanged(this, ref);
}
},
async submit() {
let vm = this;
if (vm.canSave) {