This commit is contained in:
2018-11-27 23:12:34 +00:00
parent ad717d034c
commit 3d643eb3b3
2 changed files with 77 additions and 10 deletions

View File

@@ -6,24 +6,21 @@
<v-icon large color="primary">fa-splotch</v-icon>
<span class="hidden-sm-and-down">Widgets</span>
</v-toolbar-title>
<v-spacer></v-spacer>
<v-btn icon>
<v-btn icon @click="newItem()">
<v-icon>fa-plus-circle</v-icon>
</v-btn>
<v-btn icon>
<v-icon>fa-filter</v-icon>
</v-btn>
<v-btn icon @click="getDataFromApi()">
<v-icon>fa-sync</v-icon>
</v-btn>
<v-btn icon >
<v-btn icon>
<v-icon>fa-ellipsis-v</v-icon>
</v-btn>
</v-toolbar>
<WidgetEdit/>
<v-data-table
v-model="selected"
:headers="headers"
@@ -55,7 +52,11 @@
<script>
/* xeslint-disable */
import pagedList from "../api/pagedlist";
import WidgetEdit from "../components/inventorywidgetedit";
export default {
components: {
WidgetEdit
},
data() {
return {
dialog: false,
@@ -127,6 +128,11 @@ export default {
if (this.selected.length) this.selected = [];
else this.selected = this.Items.slice();
},
newItem() {
this.WidgetEdit.dialog = true;
this.dialog = true;
},
getDataFromApi() {
var listOptions = {
Offset: 0,
@@ -147,19 +153,16 @@ export default {
this.totalItems = res.paging.count;
});
},
editItem(item) {
this.editedIndex = this.Items.indexOf(item);
this.editedItem = Object.assign({}, item);
this.dialog = true;
},
deleteItem(item) {
const index = this.Items.indexOf(item);
confirm("Are you sure you want to delete this item?") &&
this.Items.splice(index, 1);
},
close() {
this.dialog = false;
setTimeout(() => {
@@ -167,7 +170,6 @@ export default {
this.editedIndex = -1;
}, 300);
},
save() {
if (this.editedIndex > -1) {
Object.assign(this.Items[this.editedIndex], this.editedItem);