Blame view

src/components/staff/deleteStaffCommunity.vue 1.27 KB
6c157c6e   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
  <template>
    <el-dialog :title="$t('staffCommunity.deleteConfirmTitle')" :visible.sync="visible" width="30%">
  
        <div class="text-center">
          <p>{{ $t('staffCommunity.deleteConfirmText') }}</p>
        </div>
        <div slot="footer" class="dialog-footer">
          <el-button @click="visible = false">{{ $t('common.cancel') }}</el-button>
          <el-button type="primary" @click="confirmDelete">{{ $t('common.confirm') }}</el-button>
        </div>
  
    </el-dialog>
  </template>
  
  <script>
  import { deleteStaffCommunity } from '@/api/staff/staffCommunityApi'
  
  export default {
    name: 'DeleteStaffCommunity',
    data() {
      return {
        visible: false,
        currentData: {}
      }
    },
    methods: {
      open(data) {
        this.visible = true
        this.currentData = { ...data }
      },
      async confirmDelete() {
        try {
          await deleteStaffCommunity(this.currentData)
          this.$message.success(this.$t('staffCommunity.deleteSuccess'))
          this.$emit('success')
          this.visible = false
        } catch (error) {
          this.$message.error(this.$t('staffCommunity.deleteError'))
        }
      }
    }
  }
  </script>
  
  <style scoped>
  .text-center {
    text-align: center;
    margin: 20px 0;
    font-size: 16px;
  }
  
  .dialog-footer {
    text-align: right;
    margin-top: 20px;
  }
  </style>