inwareDialog.vue 2.07 KB
<template>
  <el-dialog
    title="空托盘入库"
    :visible.sync="visible"
    :showinware="showinware"
    width="500px"
    append-to-body
    @close="$emit('update:showinware', false)"
    @open="diaOpen"
  >
    <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="80px">
  <el-form-item label="容器编码" prop="containerCode">
    <el-input v-model="ruleForm.containerCode"></el-input>
  </el-form-item>
  <el-form-item label="目的库位" prop="destinationLocation">
    <el-input  v-model="ruleForm.destinationLocation"></el-input>
  </el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
  </el-dialog>
</template>

<script>

import { emptyIn } from '@/api/inventory/inventoryHeader/header'
export default {
  props: {
    showinware: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      visible: this.showinware,
      ruleForm: {
          containerCode:'',
           destinationLocation:''
      },
      rules: {
        containerCode:[{ required: true, message: '容器编码不能为空', trigger: ['blur','change'] }]
      }
    }
  },
  watch: {
    showinware() {
      this.visible = this.showinware
    }
  },
  methods: {
    diaOpen() {
      this.resetForm('ruleForm')

    },
     submitForm() {
        this.$refs["ruleForm"].validate((valid) => {
          if (valid) {
           emptyIn(this.ruleForm).then(response=>{
             if(response.code == 200) {
               console.log(response)
               this.msgSuccess(response.msg)
               this.visible = false
               this.$parent.getHeaderList()
             }else {
               this.msgError(response.msg)
             }
           })

          } else {
            console.log('error submit!!');
            return false;
          }
        });
      },
      cancel() {
        this.resetForm('ruleForm')
        this.visible = false
      }
  }
}
</script>

<style lang="scss" scoped>
</style>