Blame view

src/components/car/deleteParkingArea.vue 1.83 KB
e18d1bbb   wuxw   开发完成停车场 和停车位功能
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
  <template>
    <el-dialog :title="$t('parkingAreaManage.deleteTitle')" :visible.sync="visible" width="30%" center>
      <div style="text-align: center">
        <p>{{ $t('parkingAreaManage.deleteConfirm') }}</p>
        <p style="font-weight: bold; color: #e6a23c; margin-top: 10px">
          {{ deleteParkingAreaInfo.num }} ({{ parkingTypeLabel }})
        </p>
      </div>
  
      <div slot="footer" class="dialog-footer">
        <el-button @click="visible = false">{{ $t('common.cancel') }}</el-button>
        <el-button type="danger" @click="deleteParkingArea" :loading="deleting">
          {{ $t('common.confirm') }}
        </el-button>
      </div>
    </el-dialog>
  </template>
  
  <script>
  import { deleteParkingArea } from '@/api/car/parkingAreaManageApi'
  import { getCommunityId } from '@/api/community/communityApi'
  
  export default {
    name: 'DeleteParkingArea',
    data() {
      return {
        visible: false,
        deleting: false,
        deleteParkingAreaInfo: {}
      }
    },
    computed: {
      parkingTypeLabel() {
        return this.deleteParkingAreaInfo.typeCd === '1001'
          ? this.$t('parkingAreaManage.aboveGround')
          : this.$t('parkingAreaManage.underground')
      }
    },
    methods: {
      open(row) {
        this.visible = true
        this.deleteParkingAreaInfo = { ...row }
      },
  
      async deleteParkingArea() {
        try {
          this.deleting = true
          const params = {
            paId: this.deleteParkingAreaInfo.paId,
            communityId: getCommunityId()
          }
  
          await deleteParkingArea(params)
          this.$message.success(this.$t('parkingAreaManage.deleteSuccess'))
          this.visible = false
          this.$emit('success')
        } catch (error) {
          console.error('删除停车场失败:', error)
          this.$message.error(this.$t('parkingAreaManage.deleteFailed'))
        } finally {
          this.deleting = false
        }
      }
    }
  }
  </script>