Blame view

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