cuilei
2025-06-13 1e653db94c24389cc7615fd4a7ef1d63b00af534
src/views/dnc/base/modules/TerminalIndex/ReportEquipmentClose/MaintainShutdownModal.vue
@@ -1,58 +1,69 @@
<template>
  <a-modal :visible="visible" title="维护停机" @ok="handleSubmit" @cancel="handleCancel">
  <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="closeReason" label="停机原因">
        <a-select v-model="model.closeReason" placeholder="请选择停机原因">
          <a-select-option v-for="item in closeReasonList" :key="item.id">
      <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>
  </a-modal>
  </j-modal>
</template>
<script>
  import { postAction } from '@/api/manage'
  export default {
    name: 'MaintainShutdownModal',
    props: {
      downtimeDescriptionList: {
        type: Array
      }
    },
    data() {
      return {
        visible: false,
        model: {},
        validateRules: {
          closeReason: [{ required: true, message: '请选择停机原因!' }]
          reasonId: [{ required: true, message: '请选择停机原因!' }]
        },
        closeReasonList: [
          {
            id: 1,
            label: '吃饭时间休息'
          },
          {
            id: 2,
            label: '工作时间休息'
          },
          {
            id: 3,
            label: '计划性停电'
          },
          {
            id: 4,
            label: '待料停机'
          },
          {
            id: 5,
            label: '首件调试'
          },
          {
            id: 6,
            label: '刀量具准备'
          }
        ]
        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() {