booking.vue 5.71 KB
Newer Older
huhaiiqng's avatar
huhaiiqng committed
1
<template>
huhaiiqng's avatar
huhaiiqng committed
2
  <div>
huhaiqing's avatar
huhaiqing committed
3 4
    <el-form ref="bookingForm" :rules="rules" :model="bookingObj" label-width="140px">
      <el-form-item label="SO NO.">
5
        <el-input v-model="bookingObj.sono" :placeholder="$t('请输入SO NO.')"></el-input>
huhaiiqng's avatar
huhaiiqng committed
6
      </el-form-item>
7 8
      <el-form-item :label="$t('船公司类型')">
        <supplierSelect v-model="bookingObj.shipCompanyType" :companyType="'9'" :placeholder="$t('请选择船公司类型')" :allSupplier="this.$attrs.allSupplier" />
huhaiiqng's avatar
huhaiiqng committed
9
      </el-form-item>
10
      <el-form-item :label="$t('驳船港')">
11
        <dockSelect v-model="bookingObj.bargePortId" :placeholder="$t('请选择驳船港')" portType="2" :allDocks="this.$attrs.allDocks" />
huhaiiqng's avatar
huhaiiqng committed
12
      </el-form-item>
13
      <el-form-item :label="$t('起运港')">
14
        <dockSelect v-model="bookingObj.bigPortId" :placeholder="$t('请选择起运港')" portType="2" :allDocks="this.$attrs.allDocks" />
huhaiiqng's avatar
huhaiiqng committed
15
      </el-form-item>
16
      <el-form-item :label="$t('目的港')">
17
        <dockSelect v-model="bookingObj.destPortId" :placeholder="$t('请选择目的港')" portType="2" :allDocks="this.$attrs.allDocks" />
huhaiiqng's avatar
huhaiiqng committed
18
      </el-form-item>
19 20
      <el-form-item :label="$t('订舱公司')">
        <supplierSelect v-model="bookingObj.spaceCompanyId" :companyType="'1'" :placeholder="$t('请选择订舱公司')" :allSupplier="this.$attrs.allSupplier" />
huhaiiqng's avatar
huhaiiqng committed
21
      </el-form-item>
22 23
      <el-form-item :label="$t('预计驳船时间')">
        <el-date-picker type="datetime" :placeholder="$t('请选择日期')" value-format="yyyy-MM-dd HH:mm:ss" v-model="bookingObj.bargeTime"></el-date-picker>
huhaiiqng's avatar
huhaiiqng committed
24 25 26
      </el-form-item>

      <el-row>
huhaiqing's avatar
huhaiqing committed
27
        <el-col :span="12">
28 29
          <el-form-item :label="$t('预计开船时间')" prop="sailTime">
            <el-date-picker type="datetime" :placeholder="$t('请选择日期')" value-format="yyyy-MM-dd HH:mm:ss" v-model="bookingObj.sailTime"></el-date-picker>
huhaiiqng's avatar
huhaiiqng committed
30 31
          </el-form-item>
        </el-col>
huhaiqing's avatar
huhaiqing committed
32
        <el-col :span="12">
33 34
          <el-form-item :label="$t('通知人')" label-width="80px">
            <userSelect v-model="bookingObj.sailNotifyUser" :placeholder="$t('请选择通知人')" :allUsers="this.$attrs.allUsers" />
huhaiiqng's avatar
huhaiiqng committed
35 36 37 38 39
          </el-form-item>
        </el-col>
      </el-row>

      <el-row>
huhaiqing's avatar
huhaiqing committed
40
        <el-col :span="12">
41
          <el-form-item :label="$t('截补料时间')">
42
            <el-date-picker type="datetime" :placeholder="$t('请选择日期')" value-format="yyyy-MM-dd HH:mm:ss" v-model="bookingObj.ladingBillTime"></el-date-picker>
huhaiiqng's avatar
huhaiiqng committed
43 44
          </el-form-item>
        </el-col>
huhaiqing's avatar
huhaiqing committed
45
        <el-col :span="12">
46 47
          <el-form-item :label="$t('通知人')" label-width="80px">
            <userSelect v-model="bookingObj.ladingBillNotifyUser" :placeholder="$t('请选择通知人')" :allUsers="this.$attrs.allUsers" />
huhaiiqng's avatar
huhaiiqng committed
48 49 50 51 52
          </el-form-item>
        </el-col>
      </el-row>

      <el-row>
huhaiqing's avatar
huhaiqing committed
53
        <el-col :span="12">
54
          <el-form-item :label="$t('VGM提交时间')">
55
            <el-date-picker type="datetime" :placeholder="$t('请选择日期')" value-format="yyyy-MM-dd HH:mm:ss" v-model="bookingObj.customsTime"></el-date-picker>
huhaiiqng's avatar
huhaiiqng committed
56 57
          </el-form-item>
        </el-col>
huhaiqing's avatar
huhaiqing committed
58
        <el-col :span="12">
59 60
          <el-form-item :label="$t('通知人')" label-width="80px">
            <userSelect v-model="bookingObj.customsNotifyUser" :placeholder="$t('请选择通知人')" :allUsers="this.$attrs.allUsers" />
huhaiiqng's avatar
huhaiiqng committed
61 62 63 64 65
          </el-form-item>
        </el-col>
      </el-row>

      <el-row>
huhaiqing's avatar
huhaiqing committed
66
        <el-col :span="12">
67
          <el-form-item :label="$t('截关时间')">
68
            <el-date-picker type="datetime" :placeholder="$t('请选择日期')" value-format="yyyy-MM-dd HH:mm:ss" v-model="bookingObj.cutOffTime"></el-date-picker>
huhaiiqng's avatar
huhaiiqng committed
69 70
          </el-form-item>
        </el-col>
huhaiqing's avatar
huhaiqing committed
71
        <el-col :span="12">
72 73
          <el-form-item :label="$t('通知人')" label-width="80px">
            <userSelect v-model="bookingObj.cutOffNotifyUser" :placeholder="$t('请选择通知人')" :allUsers="this.$attrs.allUsers" />
huhaiiqng's avatar
huhaiiqng committed
74 75 76 77 78 79
          </el-form-item>
        </el-col>
      </el-row>

    </el-form>
    <el-row class="operate-button">
80 81
      <el-button type="primary" @click="onSubmit">{{$t('提交')}}</el-button>
      <el-button @click="cancel">{{$t('关闭')}}</el-button>
huhaiiqng's avatar
huhaiiqng committed
82 83 84
    </el-row>
  </div>

huhaiiqng's avatar
huhaiiqng committed
85 86 87
</template>

<script>
huhaiqing's avatar
huhaiqing committed
88
import { booking } from "@/api/ecw/boxSea";
huhaiqing's avatar
huhaiqing committed
89 90 91
import supplierSelect from "./common/supplierSelect.vue";
import dockSelect from "./common/dockSelect.vue";
import userSelect from "./common/userSelect.vue";
huhaiqing's avatar
huhaiqing committed
92
import { formatStringNumber, formatDateStr, serviceMsg } from "../utils";
huhaiqing's avatar
huhaiqing committed
93 94 95
/**
 * 订舱
 */
huhaiiqng's avatar
huhaiiqng committed
96 97
export default {
  name: "booking",
huhaiqing's avatar
huhaiqing committed
98
  inheritAttrs: false,
huhaiqing's avatar
huhaiqing committed
99 100 101 102 103
  components: {
    supplierSelect,
    dockSelect,
    userSelect,
  },
huhaiqing's avatar
huhaiqing committed
104 105 106
  props: {
    shipmentObj: Object,
  },
huhaiiqng's avatar
huhaiiqng committed
107 108
  data() {
    return {
huhaiqing's avatar
huhaiqing committed
109
      // 订舱对象
huhaiqing's avatar
huhaiqing committed
110
      bookingObj: {},
huhaiqing's avatar
huhaiqing committed
111
      // 校验
huhaiiqng's avatar
huhaiiqng committed
112
      rules: {
113
        sailTime: [{ required: true, message: this.$t("必填"), trigger: "change" }],
huhaiiqng's avatar
huhaiiqng committed
114 115 116
      },
    };
  },
117 118 119 120
  created() {
    const voName = this.$attrs.currNode.voName;
    let oldData = { ...this.shipmentObj[voName] };
    oldData = formatStringNumber(oldData, ["shipCompanyType", "spaceCompany"]);
huhaiqing's avatar
huhaiqing committed
121 122 123 124 125 126 127
    oldData = formatDateStr(oldData, [
      "sailTime",
      "bargeTime",
      "ladingBillTime",
      "customsTime",
      "cutOffTime",
    ]);
128 129
    this.bookingObj = oldData;
  },
huhaiiqng's avatar
huhaiiqng committed
130
  methods: {
huhaiqing's avatar
huhaiqing committed
131
    /** 提交 */
huhaiiqng's avatar
huhaiiqng committed
132 133 134
    onSubmit() {
      this.$refs["bookingForm"].validate((valid) => {
        if (valid) {
huhaiqing's avatar
huhaiqing committed
135
          booking({
huhaiqing106's avatar
huhaiqing106 committed
136
            shipmentId: this.shipmentObj.id,
huhaiqing's avatar
huhaiqing committed
137 138 139 140
            ...this.bookingObj,
            operateType: 2,
          }).then((res) => {
            serviceMsg(res, this).then(() => {
141
              this.cancel("submit");
huhaiqing's avatar
huhaiqing committed
142 143
            });
          });
huhaiiqng's avatar
huhaiiqng committed
144 145 146
        }
      });
    },
huhaiqing's avatar
huhaiqing committed
147
    /** 取消 */
148 149
    cancel(type) {
      this.$emit("closeDialog", type);
huhaiiqng's avatar
huhaiiqng committed
150 151 152 153
    },
  },
};
</script>