deleteRoom.vue
1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<template>
<el-dialog :title="$t('room.deleteRoom.title')" :visible.sync="dialogVisible" width="30%">
<div style="text-align: center">
<p>{{ $t('room.deleteRoom.confirmMessage') }}</p>
</div>
<div slot="footer">
<el-button @click="dialogVisible = false">{{ $t('common.cancel') }}</el-button>
<el-button type="danger" @click="deleteRoom">{{ $t('common.confirm') }}</el-button>
</div>
</el-dialog>
</template>
<script>
import { deleteRoom } from '@/api/room/deleteRoomApi'
export default {
name: 'DeleteRoom',
data() {
return {
dialogVisible: false,
roomInfo: {}
}
},
created() {
},
beforeDestroy() {
},
methods: {
open(roomInfo) {
this.roomInfo = roomInfo
this.dialogVisible = true
},
async deleteRoom() {
try {
this.roomInfo.communityId = this.getCommunityId()
await deleteRoom(this.roomInfo)
this.dialogVisible = false
this.$emit('handleRefreshRoom')
this.$message.success(this.$t('common.deleteSuccess'))
} catch (error) {
console.error('删除房屋失败', error)
this.$message.error(error.message || this.$t('common.deleteFailed'))
}
},
}
}
</script>