<template>
  <div>
    <el-form ref="recallForm" :model="recallObj" label-width="100px">
      <el-form-item :label="$t('备注')">
        <el-input v-model="recallObj.remark" type="textarea" rows="2" :placeholder="$t('请输入备注')"></el-input>
      </el-form-item>
    </el-form>

    <el-row class="operate-button">
      <el-button  type="success" @click="onSubmit()">{{$t('提交')}}</el-button>
    </el-row>
  </div>
</template>

<script>
import { airShipmentRecall} from "@/api/ecw/boxSea";
import { formatDateStr, formatNumberString, serviceMsg } from "../utils";

/**
 * 驳船
 */
export default {
  name: "recall",
  inheritAttrs: false,
  data() {
    return {
      // 空运出货对象
      recallObj: {},
      airShipmentApprovalInfo: {}
    };
  },
  created() {
    const voName = this.$attrs.currNode.voName;
    let oldData = { ...this.$attrs.shipmentObj[voName] };
    oldData = formatDateStr(oldData, ["deliverTime"]);
    oldData = formatNumberString(oldData, ["deliverType"]);
    this.airShipmentObj = oldData;
    this.airShipmentApprovalInfo = this.$attrs.shipmentObj.airShipmentApprovalInfo
    debugger
  },
  methods: {
    /** 提交 */
    onSubmit() {
      const that = this;
      this.$refs["recallForm"].validate((valid) => {
        if (valid) {
          debugger
          airShipmentRecall({
            ...that.airShipmentObj,
            ...that.recallObj,
            shipmentId: that.$attrs.shipmentObj.id,
          }).then((res) => {
            serviceMsg(res, this).then(() => {
              this.cancel("submit");
            });
          });
        }
      });
    },
    /** 取消 */
    cancel(type) {
      this.$emit("closeDialog", type);
    },
  },
};
</script>

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