<template>
  <el-dialog
    title="开始维修"
    append-to-body
    :visible.sync="dialogVisible"
    :before-close="handleClose"
    width="550px"
    destroy-on-close
    @close="close"
  >
    <el-form ref="form" :inline="true" :model="form4" size="mini" label-width="120px" label-suffix=":">
      <el-row>
        <el-col :span="24">
          <el-form-item label="维修人" prop="update_optname">
            <el-input v-model="form4.update_optname" style="width: 200px;" />
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>

    <span slot="footer" class="dialog-footer">
      <el-button icon="el-icon-check" size="mini" type="primary" @click="submitResuft">保存</el-button>
      <el-button icon="el-icon-close" size="mini" type="info" @click="close">关闭</el-button>
    </span>

  </el-dialog>
</template>
<script>

import CRUD, { crud } from '@crud/crud'
import crudDevicemaintenancemst from '@/api/wms/sb/devicemaintenancemst'
export default {
  name: 'StartDialog',
  mixins: [crud()],
  props: {
    dialogShow: {
      type: Boolean,
      default: false
    },
    openParam: {
      type: Object
    }
  },
  watch: {
    dialogShow: {
      handler(newValue, oldValue) {
        this.dialogVisible = newValue
        this.form4 = this.openParam
      }
    }
  },
  data() {
    return {
      form4: {
      },
      dialogVisible: false
    }
  },
  methods: {
    handleClose(done) {
      this.$confirm('确认关闭？')
        .then(_ => {
          done()
        })
        .catch(_ => {
        })
    },
    close() {
      this.$emit('update:dialogShow', false)
    },
    submitResuft() {
      if (!this.form4.update_optname) {
        return this.crud.notify('保养人不能为空', CRUD.NOTIFICATION_TYPE.INFO)
      }
      const data = this.form4
      crudDevicemaintenancemst.startMaintain(data).then(res => {
        this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
        this.dialogVisible = false
        this.crud.toQuery()
      })
    }
  }
}
</script>

<style>
.crud-opts2 {
  padding: 0;
  display: -webkit-flex;
  display: flex;
  align-items: center;
}

.crud-opts2 .el-dialog__title2 {
  line-height: 24px;
  font-size:20px;
  color:#303133;
}

.crud-opts2 .role-span {
  padding: 10px 0px 10px 0px;
}
.crud-opts2 .crud-opts-form {
  padding: 10px 0px 0px 20px;
}

.input-with-select  {
  background-color: #fff;
}

</style>
