deleteMaintainanceStandardItem.vue
1.88 KB
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
67
68
69
70
71
72
73
<template>
<el-dialog :title="$t('deleteMaintainanceStandardItem.title')" :visible.sync="visible" width="30%" @close="handleClose">
<el-row>
<el-col :span="24">
<div style="text-align: center; margin-bottom: 20px;">
{{ $t('deleteMaintainanceStandardItem.confirmMessage') }}
</div>
<div style="text-align: center;">
<el-button @click="handleClose">
{{ $t('deleteMaintainanceStandardItem.cancel') }}
</el-button>
<el-button type="primary" @click="confirmDelete" style="margin-left: 20px;">
{{ $t('deleteMaintainanceStandardItem.confirm') }}
</el-button>
</div>
</el-col>
</el-row>
</el-dialog>
</template>
<script>
import { deleteMaintainanceStandardItem } from '@/api/inspection/maintainanceStandardItemApi'
import { getCommunityId } from '@/api/community/communityApi'
export default {
name: 'DeleteMaintainanceStandardItem',
data() {
return {
visible: false,
form: {
itemId: '',
msiId: '',
standardId: ''
}
}
},
methods: {
open(params) {
this.form = {
itemId: params.itemId,
msiId: params.msiId,
standardId: params.standardId
}
this.visible = true
},
async confirmDelete() {
try {
const params = {
...this.form,
communityId: getCommunityId()
}
await deleteMaintainanceStandardItem(params)
this.$message.success(this.$t('common.operationSuccess'))
this.$emit('success')
this.handleClose()
} catch (error) {
this.$message.error(this.$t('deleteMaintainanceStandardItem.deleteError'))
}
},
handleClose() {
this.visible = false
this.resetForm()
},
resetForm() {
this.form = {
itemId: '',
standardId: ''
}
}
}
}
</script>