<template>
  <div>
    <el-form ref="unloadingForm" :model="unloadingObj" label-width="100px">
      <el-form-item label="网点">
        <el-select v-model="unloadingObj.outlets" placeholder="请选择网点">
        </el-select>
      </el-form-item>
      <el-form-item label="到仓时间">
        <el-date-picker type="date" placeholder="请选择日期" v-model="unloadingObj.warehouseTime"></el-date-picker>
      </el-form-item>
      <el-form-item label="卸柜时间">
        <el-date-picker type="datetime" placeholder="请选择日期" v-model="unloadingObj.unloadingTime"></el-date-picker>
      </el-form-item>
    </el-form>

    <el-row class="operate-button">
      <el-button type="primary">保存</el-button>
      <el-button type="success" @click="onSubmit">提交</el-button>
      <el-button @click="cancel">关闭</el-button>
      <el-button type="danger" @click="startUnloading">开始卸柜</el-button>
    </el-row>

    <!-- 开始卸柜 -->
    <el-dialog title="开始卸柜" :visible.sync="dialogVisible" fullscreen :modal-append-to-body=false append-to-body destroy-on-close>
      <startUnloading />
    </el-dialog>
  </div>
</template>

<script>
import startUnloading from "./startUnloading.vue";

/**
 * 卸柜
 */
export default {
  name: "unloading",
  components: { startUnloading },
  data() {
    return {
      // 清关对象
      unloadingObj: {
        agent: "test111",
      },
      // 弹窗状态
      dialogVisible: false,
    };
  },
  watch: {},
  methods: {
    /** 提交 */
    onSubmit() {
      this.$refs["unloadingForm"].validate((valid) => {
        if (valid) {
          // TODO 判断是否已经卸柜
          this.$message.warning("请先通过卸柜审批");
        }
      });
    },
    /** 取消 */
    cancel() {
      this.$emit("closeDialog");
    },
    // 开始卸柜
    startUnloading() {
      this.dialogVisible = true;
    },
  },
};
</script>

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