Blame view

src/components/inspection/deleteMaintainanceStandardItem.vue 1.88 KB
6ec243d6   wuxw   v1.9 点击提交后,成功提示没有...
1
  <template>
daaebda8   wuxw   开发保养计划功能
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
    <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)
6ec243d6   wuxw   v1.9 点击提交后,成功提示没有...
54
          this.$message.success(this.$t('common.operationSuccess'))
daaebda8   wuxw   开发保养计划功能
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
          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>