outwareDialog.vue 2.16 KB
<template>
  <el-dialog
    title="空托盘出库"
    :visible.sync="visible"
    :showoutware="showoutware"
    width="500px"
    append-to-body
    @close="$emit('update:showoutware', false)"
  >
    <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="sourceLocation">
        <el-input v-model="ruleForm.sourceLocation"></el-input>
      </el-form-item>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button
        type="primary"
        @click="selectEmptyOut"
        v-hasPermi="['inventory:inventoryHeader:emptyCheckOut']"
        >选取空容器</el-button
      >
      <el-button type="primary" @click="submitForm">确定</el-button>
      <el-button @click="cancel">取消</el-button>
    </div>
    <empty-container-dialog
      @passValue="getValue"
      :showcontainer.sync="showContainer"
    />
  </el-dialog>
</template>

<script>
import { createEmptyOut } from "@/api/task/taskHeader";
import emptyContainerDialog from "./emptyContainerDialog";
export default {
  components: {
    emptyContainerDialog,
  },
  props: {
    showoutware: {
      type: Boolean,
      default: false,
    },
  },
  data() {
    return {
      visible: this.showoutware,
      showContainer: false,
      ruleForm: {
        containerCode: "",
        sourceLocation: "",
      },
      rules: {},
    };
  },
  watch: {
    showoutware() {
      this.visible = this.showoutware;
    },
  },
  methods: {
    selectEmptyOut() {
      this.showContainer = true;
    },
    getValue(value1, value2) {
      this.ruleForm.containerCode = value2;
      this.ruleForm.sourceLocation = value1;
    },
    submitForm() {
      this.$refs["ruleForm"].validate((valid) => {
        if (valid) {
          createEmptyOut(this.ruleForm).then((response) => {
            this.visible = false;
          });
        } else {
          return false;
        }
      });
    },
    cancel() {
      this.resetForm("ruleForm");
      this.visible = false;
    },
  },
};
</script>