cuilei
2025-06-13 1e653db94c24389cc7615fd4a7ef1d63b00af534
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
74
75
76
77
78
79
<template>
  <j-modal :visible="visible" title="维护停机" @ok="handleSubmit" @cancel="handleCancel" :confirmLoading="confirmLoading">
    <a-form-model ref="form" :model="model" :rules="validateRules" :labelCol="{span:5}" :wrapperCol="{span:18}">
      <a-form-model-item prop="reasonId" label="停机原因">
        <a-select v-model="model.reasonId" placeholder="请选择停机原因">
          <a-select-option v-for="item in downtimeDescriptionList" :key="item.value">
            {{item.label}}
          </a-select-option>
        </a-select>
      </a-form-model-item>
    </a-form-model>
  </j-modal>
</template>
 
<script>
  import { postAction } from '@/api/manage'
 
  export default {
    name: 'MaintainShutdownModal',
    props: {
      downtimeDescriptionList: {
        type: Array
      }
    },
    data() {
      return {
        visible: false,
        model: {},
        validateRules: {
          reasonId: [{ required: true, message: '请选择停机原因!' }]
        },
        confirmLoading: false,
        url: {
          submit: '/mdc/operator/mdcDowntime/updateReason'
        }
      }
    },
    methods: {
      handleSubmit() {
        const that = this
        this.$refs.form.validate(valid => {
          if (valid) {
            that.confirmLoading = true
            postAction(that.url.submit, that.model)
              .then(res => {
                if (res.success) {
                  that.$notification.success({
                    message: '消息',
                    description: res.message
                  })
                  that.handleCancel()
                  that.$emit('submitSuccess')
                } else {
                  that.$notification.warning({
                    message: '消息',
                    description: res.message
                  })
                }
              })
              .finally(() => {
                that.confirmLoading = false
              })
          } else {
            return false
          }
        })
      },
 
      handleCancel() {
        this.$refs.form.clearValidate()
        this.visible = false
      }
    }
  }
</script>
 
<style scoped>
 
</style>