This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
<template>
|
||||
<v-layout row justify-center>
|
||||
<v-dialog v-model="dialog" persistent max-width="600px">
|
||||
<v-dialog v-model="dialogdata.dialog" persistent max-width="600px">
|
||||
<!-- <v-btn slot="activator" color="primary" dark>Open Dialog</v-btn> -->
|
||||
<v-card>
|
||||
<v-card-title>
|
||||
<span class="headline">User Profile</span>
|
||||
<span class="headline">User Profile ID: {{dialogdata.recordId}}</span>
|
||||
</v-card-title>
|
||||
<v-card-text>
|
||||
<v-container grid-list-md>
|
||||
@@ -56,14 +56,16 @@
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
dialogdata: {
|
||||
dialog: false,
|
||||
recordId: 0
|
||||
},
|
||||
dialog: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
data: () => ({
|
||||
dataDialog: false
|
||||
})
|
||||
data: () => ({})
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<v-icon>fa-ellipsis-v</v-icon>
|
||||
</v-btn>
|
||||
</v-toolbar>
|
||||
<WidgetEdit :dialog="dialog" v-on:dialogclose="dialog=false"/>
|
||||
<WidgetEdit :dialogdata="dialogdata" v-on:dialogclose="dialogdata.dialog=false"/>
|
||||
<v-data-table
|
||||
v-model="selected"
|
||||
:headers="headers"
|
||||
@@ -59,7 +59,10 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialog: false,
|
||||
dialogdata: {
|
||||
dialog: false,
|
||||
recordId: 2
|
||||
},
|
||||
editedIndex: -1,
|
||||
editedItem: {
|
||||
name: "",
|
||||
@@ -130,7 +133,8 @@ export default {
|
||||
},
|
||||
|
||||
newItem() {
|
||||
this.dialog = true;
|
||||
this.dialogdata.recordId = -1;
|
||||
this.dialogdata.dialog = true;
|
||||
},
|
||||
getDataFromApi() {
|
||||
var listOptions = {
|
||||
@@ -153,29 +157,8 @@ export default {
|
||||
});
|
||||
},
|
||||
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(() => {
|
||||
this.editedItem = Object.assign({}, this.defaultItem);
|
||||
this.editedIndex = -1;
|
||||
}, 300);
|
||||
},
|
||||
save() {
|
||||
if (this.editedIndex > -1) {
|
||||
Object.assign(this.Items[this.editedIndex], this.editedItem);
|
||||
} else {
|
||||
this.Items.push(this.editedItem);
|
||||
}
|
||||
this.close();
|
||||
this.dialogdata.recordId = this.Items.indexOf(item);
|
||||
this.dialogdata.dialog = true;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user