deleteAStaffCommunity.vue 1.9 KB
<template>
  <el-dialog
    :title="$t('deleteAStaffCommunity.confirmOperation')"
    :visible.sync="visible"
    width="30%"
    :before-close="handleClose">
    <div class="text-center">
      <p>{{ $t('deleteAStaffCommunity.confirmDelete') }}</p>
    </div>
    <span slot="footer" class="dialog-footer">
      <el-button @click="handleClose">{{ $t('deleteAStaffCommunity.cancel') }}</el-button>
      <el-button type="primary" @click="deleteStaffCommunity">{{ $t('deleteAStaffCommunity.confirm') }}</el-button>
    </span>
  </el-dialog>
</template>

<script>
import { deleteStaffCommunity } from '@/api/staff/aStaffDetailApi'

export default {
  name: 'DeleteAStaffCommunity',
  data() {
    return {
      visible: false,
      community: {}
    }
  },
  methods: {
    open(community) {
      this.community = community
      this.visible = true
    },
    handleClose() {
      this.visible = false
    },
    async deleteStaffCommunity() {
      try {
        await deleteStaffCommunity(this.community)
        this.$message.success(this.$t('deleteAStaffCommunity.deleteSuccess'))
        this.visible = false
        this.$emit('success')
      } catch (error) {
        this.$message.error(this.$t('deleteAStaffCommunity.deleteError'))
      }
    }
  }
}
</script>

<i18n>
{
  "en": {
    "deleteAStaffCommunity": {
      "confirmOperation": "Confirm Your Operation",
      "confirmDelete": "Are you sure you want to delete this community?",
      "cancel": "Cancel",
      "confirm": "Confirm Delete",
      "deleteSuccess": "Community deleted successfully",
      "deleteError": "Failed to delete community"
    }
  },
  "zh": {
    "deleteAStaffCommunity": {
      "confirmOperation": "请确认您的操作",
      "confirmDelete": "确定删除隶属小区?",
      "cancel": "点错了",
      "confirm": "确认删除",
      "deleteSuccess": "小区删除成功",
      "deleteError": "小区删除失败"
    }
  }
}
</i18n>