Blame view

src/components/community/deleteCityArea.vue 1.09 KB
a42b3256   wuxw   HC小区管理系统前段vue版正在开发中
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
  <template>
    <el-dialog 
      :title="$t('cityArea.confirmOperation')" 
      :visible.sync="visible" 
      width="30%">
      <div class="text-center">
        <p>{{ $t('cityArea.confirmDeleteArea') }}</p>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="visible = false">{{ $t('cityArea.cancelDelete') }}</el-button>
        <el-button type="primary" @click="handleDelete">{{ $t('cityArea.confirmDelete') }}</el-button>
      </span>
    </el-dialog>
  </template>
  
  <script>
  import { deleteArea } from '@/api/community/cityAreaApi'
  
  export default {
    name: 'DeleteCityArea',
    data() {
      return {
        visible: false,
        currentArea: {}
      }
    },
    methods: {
      open(params) {
        this.currentArea = { ...params }
        this.visible = true
      },
      async handleDelete() {
        try {
          await deleteArea(this.currentArea)
          this.$message.success(this.$t('common.deleteSuccess'))
          this.visible = false
          this.$emit('refresh')
        } catch (error) {
          this.$message.error(error.message || this.$t('common.deleteFailed'))
        }
      }
    }
  }
  </script>