ship.vue 1.93 KB
Newer Older
huhaiqing's avatar
huhaiqing committed
1 2
<template>
  <div>
huhaiqing's avatar
huhaiqing committed
3 4 5
    <el-form ref="shipForm" :model="shipObj" :rules="rules" label-width="80px">
      <el-form-item label="状态" prop="saExmtStatus">
        <el-radio-group v-model="shipObj.saExmtStatus">
huhaiqing's avatar
huhaiqing committed
6 7 8
          <el-radio v-for="item in status" :key="item.value" :label="item.value">{{item.label}}</el-radio>
        </el-radio-group>
      </el-form-item>
huhaiqing's avatar
huhaiqing committed
9
      <el-form-item label="配船时间" v-show="shipObj.saExmtStatus === '2'">
huhaiqing's avatar
huhaiqing committed
10
        <el-date-picker type="date" placeholder="请选择日期" v-model="shipObj.shipTime" value-format="yyyy-MM-dd"></el-date-picker>
huhaiqing's avatar
huhaiqing committed
11 12 13 14
      </el-form-item>
    </el-form>

    <el-row class="operate-button">
huhaiqing's avatar
huhaiqing committed
15 16
      <el-button type="primary" @click="onSubmit(1)">保存</el-button>
      <el-button type="success" @click="onSubmit(2)">提交</el-button>
huhaiqing's avatar
huhaiqing committed
17 18 19 20 21 22
      <el-button @click="cancel">关闭</el-button>
    </el-row>
  </div>
</template>

<script>
huhaiqing's avatar
huhaiqing committed
23
import { shipConfigure, serviceMsg } from "@/api/ecw/boxSea";
huhaiqing's avatar
huhaiqing committed
24 25 26 27 28
/**
 * 配船
 */
export default {
  name: "ship",
huhaiqing's avatar
huhaiqing committed
29 30 31
  props: {
    shipmentObj: Object,
  },
huhaiqing's avatar
huhaiqing committed
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
  data() {
    return {
      // 配船对象
      shipObj: {},
      // 状态
      status: [
        {
          value: "1",
          label: "免配",
        },
        {
          value: "2",
          label: "已配",
        },
      ],
huhaiqing's avatar
huhaiqing committed
47 48 49 50
      // 校验
      rules: {
        saExmtStatus: [{ required: true, message: "必填", trigger: "change" }],
      },
huhaiqing's avatar
huhaiqing committed
51 52 53 54
    };
  },
  methods: {
    /** 提交 */
huhaiqing's avatar
huhaiqing committed
55
    onSubmit(operateType) {
huhaiqing's avatar
huhaiqing committed
56 57
      this.$refs["shipForm"].validate((valid) => {
        if (valid) {
huhaiqing's avatar
huhaiqing committed
58 59 60 61 62 63 64 65 66
          shipConfigure({
            operateType,
            shipmentId: this.shipmentObj.id,
            ...this.shipObj,
          }).then((res) => {
            serviceMsg(res, this).then(() => {
              this.cancel();
            });
          });
huhaiqing's avatar
huhaiqing committed
67 68 69 70 71 72 73 74 75 76 77 78 79
        }
      });
    },
    /** 取消 */
    cancel() {
      this.$emit("closeDialog");
    },
  },
};
</script>

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