<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>
|