Blame view

src/components/scm/DeleteSupplier.vue 1.45 KB
f22ec63c   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
  <template>
    <el-dialog
      :title="$t('supplierManage.confirmDelete')"
      :visible.sync="visible"
      width="500px">
      <div class="text-center">
        <p>{{ $t('supplierManage.deleteTip') }}</p>
        <p class="mt-10"><strong>{{ supplier.supplierName }}</strong></p>
      </div>
      
      <div slot="footer" class="dialog-footer">
        <el-button @click="visible = false">{{ $t('supplierManage.cancel') }}</el-button>
        <el-button type="primary" @click="deleteSupplier">{{ $t('supplierManage.confirm') }}</el-button>
      </div>
    </el-dialog>
  </template>
  
  <script>
  import { deleteSupplier } from '@/api/scm/supplierManageApi'
  
  export default {
    name: 'DeleteSupplier',
    data() {
      return {
        visible: false,
        supplier: {}
      }
    },
    methods: {
      open(row) {
        this.supplier = { ...row }
        this.visible = true
      },
      
      async deleteSupplier() {
        try {
          const res = await deleteSupplier(this.supplier.supplierId)
          if (res.code === 0) {
            this.$message.success(this.$t('common.deleteSuccess'))
            this.visible = false
            this.$emit('success')
          } else {
            this.$message.error(res.msg || this.$t('common.deleteFailed'))
          }
        } catch (error) {
          console.error('删除供应商失败:', error)
          this.$message.error(this.$t('common.deleteFailed'))
        }
      }
    }
  }
  </script>
  
  <style scoped>
  .text-center {
    text-align: center;
  }
  
  .mt-10 {
    margin-top: 10px;
  }
  </style>