Blame view

src/components/car/deleteParkingSpace.vue 1.52 KB
6ec243d6   wuxw   v1.9 点击提交后,成功提示没有...
1
  <template>
e18d1bbb   wuxw   开发完成停车场 和停车位功能
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
    <el-dialog
      :title="$t('deleteParkingSpace.title')"
      :visible.sync="visible"
      width="30%"
      center
    >
      <div style="text-align:center">
        <p>{{ $t('deleteParkingSpace.confirmDelete') }}</p>
      </div>
      
      <div slot="footer" class="dialog-footer">
        <el-button @click="visible = false">{{ $t('deleteParkingSpace.cancel') }}</el-button>
        <el-button type="danger" @click="confirmDelete" :loading="deleting">
          {{ $t('deleteParkingSpace.confirm') }}
        </el-button>
      </div>
    </el-dialog>
  </template>
  
  <script>
  import { deleteParkingSpace } from '@/api/car/listParkingSpaceApi'
  import { getCommunityId } from '@/api/community/communityApi'
  
  export default {
    name: 'DeleteParkingSpace',
    data() {
      return {
        visible: false,
        deleting: false,
        currentParkingSpace: null
      }
    },
    methods: {
      open(row) {
        this.currentParkingSpace = { ...row, communityId: getCommunityId() }
        this.visible = true
      },
      
      async confirmDelete() {
        try {
          this.deleting = true
          const res = await deleteParkingSpace(this.currentParkingSpace)
          if (res.code === 0) {
6ec243d6   wuxw   v1.9 点击提交后,成功提示没有...
45
            this.$message.success(this.$t('common.operationSuccess'))
e18d1bbb   wuxw   开发完成停车场 和停车位功能
46
47
48
49
50
51
52
53
54
55
56
57
58
59
            this.$emit('success')
            this.visible = false
          } else {
            this.$message.error(res.msg || this.$t('common.deleteError'))
          }
        } catch (error) {
          this.$message.error(this.$t('common.deleteError'))
        } finally {
          this.deleting = false
        }
      }
    }
  }
  </script>