twoWayTakeoff.vue 3.84 KB
Newer Older
zhoutong's avatar
zhoutong committed
1 2 3
<template>
  <div>
    <el-form ref="twoWayTakeoffForm" :rules="rules" :model="twoWayTakeoffObj" label-width="120px">
wanglianghe's avatar
wanglianghe committed
4 5
      <el-form-item :label="$t('预计起飞时间')">
        {{getTakeOffTime()}}
zhoutong's avatar
zhoutong committed
6
      </el-form-item>
7 8
      <el-form-item :label="$t('预计到港时间')" prop="estTime">
        <el-date-picker type="datetime" :placeholder="$t('请选择日期')" v-model="twoWayTakeoffObj.estTime" value-format="yyyy-MM-dd HH:mm:ss"></el-date-picker>
zhoutong's avatar
zhoutong committed
9
      </el-form-item>
wanglianghe's avatar
wanglianghe committed
10 11
      <el-form-item :label="$t('实际起飞时间')" prop="dtRealFlyTime">
        <el-date-picker type="datetime" :placeholder="$t('请选择日期')" v-model="twoWayTakeoffObj.dtRealFlyTime" value-format="yyyy-MM-dd HH:mm:ss"></el-date-picker>
zhoutong's avatar
zhoutong committed
12
      </el-form-item>
zhoutong's avatar
zhoutong committed
13
      <el-form-item v-if="dtRealHeadTimeFlag" :label="$t('预计二程起飞时间')" prop="dtRealHeadTime">
wanglianghe's avatar
wanglianghe committed
14
        <el-date-picker type="datetime" :placeholder="$t('请选择日期')" v-model="twoWayTakeoffObj.dtRealHeadTime" value-format="yyyy-MM-dd HH:mm:ss"></el-date-picker>
zhoutong's avatar
zhoutong committed
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
      </el-form-item>
    </el-form>

    <el-row class="operate-button">
      <el-button type="primary" @click="onSubmit(1)">{{$t('保存')}}</el-button>
      <el-button type="success" @click="onSubmit(2)">{{$t('提交')}}</el-button>
      <el-button @click="cancel">{{$t('关闭')}}</el-button>
      <el-button type="primary" @click="exceptionReg">{{$t('异常登记')}}</el-button>
    </el-row>

    <!-- 对话框 -->
    <el-dialog custom-class="shipping-dialog" :title="$t('异常登记')" :visible.sync="dialogVisible" width="700px" :modal-append-to-body=false append-to-body destroy-on-close>
      <regError @closeDialog="dialogVisible = false" v-bind="$attrs" />
    </el-dialog>
  </div>
</template>

<script>
import regError from "../../regError";
wanglianghe's avatar
wanglianghe committed
34
import { takeoffCreate } from "@/api/ecw/boxAir";
zhoutong's avatar
zhoutong committed
35
import { formatDateStr, serviceMsg } from "../utils";
wanglianghe's avatar
wanglianghe committed
36
import dayjs from "dayjs";
zhoutong's avatar
zhoutong committed
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52

/**
 * 起飞
 */
export default {
  name: "twoWayTakeoff",
  inheritAttrs: false,
  components: {
    regError,
  },
  data() {
    return {
      // 清关对象
      twoWayTakeoffObj: {},
      // 校验
      rules: {
wanglianghe's avatar
wanglianghe committed
53
        dtRealFlyTime: [{ required: true, message: this.$t("必填"), trigger: "blur" }],
wanglianghe's avatar
wanglianghe committed
54
        dtRealHeadTime: [{ required: true, message: this.$t("必填"), trigger: "blur" }],
zhoutong's avatar
zhoutong committed
55 56 57 58 59
      },
      // 弹窗配置
      dialogVisible: false,
      // 提示消息
      showMsg: false,
60
      dtRealHeadTimeFlag: false
zhoutong's avatar
zhoutong committed
61 62 63 64 65
    };
  },
  created() {
    const voName = this.$attrs.currNode.voName;
    let oldData = { ...this.$attrs.shipmentObj[voName] };
wanglianghe's avatar
wanglianghe committed
66
    oldData = formatDateStr(oldData, ["dtRealFlyTime"], "YYYY-MM-DD HH:mm:ss");
wanglianghe's avatar
wanglianghe committed
67
    oldData = formatDateStr(oldData, ["dtRealHeadTime"], "YYYY-MM-DD HH:mm:ss");
68
    oldData = formatDateStr(oldData, ["estTime"], "YYYY-MM-DD HH:mm:ss");
zhoutong's avatar
zhoutong committed
69
    this.twoWayTakeoffObj = oldData;
70 71 72
    if(this.$attrs.shipmentObj['bookAirInfo'].voyage && this.$attrs.shipmentObj['bookAirInfo'].voyage == 2){
      this.dtRealHeadTimeFlag = true
    }
zhoutong's avatar
zhoutong committed
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
  },
  watch: {
  },
  methods: {
    // 异常登记
    exceptionReg() {
      this.dialogVisible = true;
    },
    /** 提交 */
    onSubmit(operateType) {
      this.$refs["twoWayTakeoffForm"].validate((valid) => {
        if (valid) {
          takeoffCreate({
            ...this.twoWayTakeoffObj,
            shipmentId: this.$attrs.shipmentObj.id,
            operateType,
          }).then((res) => {
            serviceMsg(res, this).then(() => {
              this.cancel("submit");
            });
          });
        }
      });
    },
    /** 取消 */
    cancel(type) {
      this.$emit("closeDialog", type);
    },
wanglianghe's avatar
wanglianghe committed
101 102 103 104 105 106 107

     // 预计开船时间
     getTakeOffTime() {
      return dayjs(this.$attrs.shipmentObj.bookAirInfo.flyTime).format(
        "YYYY-MM-DD HH:mm:ss"
      );
    },
zhoutong's avatar
zhoutong committed
108 109 110 111 112 113 114 115 116 117
  },
};
</script>

<style lang="scss" scoped>
.message-area {
  margin: 0;
  color: red;
}
</style>