This commit is contained in:
2021-05-25 18:26:08 +00:00
parent 086334f0a1
commit 6a654065eb
2 changed files with 31 additions and 36 deletions

View File

@@ -423,38 +423,6 @@ export default {
this.editItemIndex = -1;
this.formState.dirty = true;
},
// editItem: function() {},
// addItem: function() {
// let vm = this;
// let selected = vm.$refs.partId.getFullSelectionValue();
// if (selected == null || selected.id == null) {
// return;
// }
// let index = vm.obj.items.findIndex(z => z.partId == selected.id);
// if (index != -1) {
// //already in the list
// return;
// }
// vm.obj.items.push({
// partAssemblyId: vm.obj.id,
// partId: selected.id,
// partViz: selected.name,
// quantity: 1
// });
// vm.formState.dirty = true;
// },
// removeItem: function(item) {
// let vm = this;
// let index = vm.obj.items.findIndex(z => z.partId == item.partId);
// if (index == -1) {
// return;
// }
// vm.obj.items.splice(index, 1);
// vm.formState.dirty = true;
// },
openItem: function(item) {
window.$gz.eventBus.$emit("openobject", {
type: window.$gz.type.Part,

View File

@@ -4,6 +4,7 @@
<div v-if="formState.ready">
<gz-error :error-box-message="formState.errorBoxMessage"></gz-error>
<v-form ref="form">
{{ obj.items }}
<v-row>
<v-col cols="12" sm="6" lg="4" xl="3">
<v-text-field
@@ -50,9 +51,11 @@
</thead>
<tbody>
<tr
v-for="(item, index) in itemList"
v-for="item in itemList"
:key="item.Id"
:class="form().childRowErrorClass(thisVm(), 'Items', index)"
:class="
form().childRowErrorClass(thisVm(), 'Items', item.index)
"
>
<td class="text-left">
{{ item.task }}
@@ -66,7 +69,7 @@
v-if="!formState.readOnly"
large
icon
@click="editItem(index)"
@click="editItem(item.index)"
class="ml-4"
>
<v-icon small>
@@ -345,6 +348,29 @@ export default {
}
},
methods: {
addItem: function() {
let newIndex = this.obj.items.length;
this.editItemIndex =
this.obj.items.push({
id: 0,
taskGroupId: this.obj.id,
sequence: newIndex + 1, //indexes are zero based but sequences are visible to user so 1 based
task: null
}) - 1;
this.editItemDialog = true;
this.formState.dirty = true;
},
editItem: function(index) {
this.editItemIndex = index;
this.editItemDialog = true;
},
deleteItem: function() {
this.editItemDialog = false;
this.obj.items.splice(this.editItemIndex, 1);
this.editItemIndex = -1;
this.formState.dirty = true;
},
canSave: function() {
return this.formState.valid && this.formState.dirty;
},
@@ -639,7 +665,8 @@ async function fetchTranslatedText() {
"TaskGroupNotes",
"Task",
"TaskList",
"Sequence"
"Sequence",
"TaskGroupList"
]);
}
</script>