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