Blame view

src/components/inspection/deleteMaintainanceTask.vue 1.89 KB
6ec243d6   wuxw   v1.9 点击提交后,成功提示没有...
1
  <template>
788477fb   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
54
55
56
    <el-dialog
      :title="$t('deleteMaintainanceTask.title')"
      :visible.sync="visible"
      width="500px"
      @close="handleClose"
    >
      <div class="confirm-content">
        <i class="el-icon-warning warning-icon"></i>
        <span>{{ $t('deleteMaintainanceTask.confirmText') }}</span>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button @click="visible = false">
          {{ $t('deleteMaintainanceTask.cancel') }}
        </el-button>
        <el-button type="primary" @click="handleConfirm" :loading="loading">
          {{ $t('deleteMaintainanceTask.confirm') }}
        </el-button>
      </div>
    </el-dialog>
  </template>
  
  <script>
  import { deleteMaintainanceTask } from '@/api/inspection/maintainanceTaskManageApi'
  import { getCommunityId } from '@/api/community/communityApi'
  
  export default {
    name: 'DeleteMaintainanceTask',
    data() {
      return {
        visible: false,
        loading: false,
        task: {
          taskId: '',
          communityId: ''
        }
      }
    },
    methods: {
      open(data) {
        this.task = {
          taskId: data.taskId,
          communityId: getCommunityId()
        }
        this.visible = true
      },
      handleClose() {
        this.task = {
          taskId: '',
          communityId: ''
        }
      },
      handleConfirm() {
        this.loading = true
        deleteMaintainanceTask(this.task)
          .then(() => {
6ec243d6   wuxw   v1.9 点击提交后,成功提示没有...
57
            this.$message.success(this.$t('common.operationSuccess'))
788477fb   wuxw   保养功能开发完成
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
            this.$emit('success')
            this.visible = false
          })
          .catch(error => {
            this.$message.error(error.message || this.$t('deleteMaintainanceTask.error'))
          })
          .finally(() => {
            this.loading = false
          })
      }
    }
  }
  </script>
  
  <style scoped>
  .confirm-content {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
  }
  
  .warning-icon {
    color: #e6a23c;
    font-size: 24px;
    margin-right: 10px;
  }
  </style>