barge.vue 3.05 KB
Newer Older
huhaiqing's avatar
huhaiqing committed
1 2
<template>
  <div>
huhaiqing's avatar
huhaiqing committed
3
    <el-form ref="bargeForm" :model="bargeObj" :rules="rules" label-width="80px">
4
      <el-form-item :label="$t('驳船')" prop="bgExmtStatus">
huhaiqing's avatar
huhaiqing committed
5
        <el-radio-group v-model="bargeObj.bgExmtStatus">
huhaiqing's avatar
huhaiqing committed
6 7 8 9
          <el-radio v-for="item in bargeStatus" :key="item.value" :label="item.value">{{item.label}}</el-radio>
        </el-radio-group>
      </el-form-item>

huhaiqing's avatar
huhaiqing committed
10
      <div v-show="bargeObj.bgExmtStatus === '2'">
huhaiqing's avatar
huhaiqing committed
11 12
        <el-row>
          <el-col :span="12">
13 14
            <el-form-item :label="$t('驳船预计开船时间')" label-width="130px">
              <el-date-picker type="datetime" :placeholder="$t('请选择日期')" v-model="bargeObj.bgEstShipTime" value-format="yyyy-MM-dd HH:mm:ss"></el-date-picker>
huhaiqing's avatar
huhaiqing committed
15 16 17
            </el-form-item>
          </el-col>
          <el-col :span="12">
18 19
            <el-form-item :label="$t('通知人')" label-width="80px">
              <userSelect v-model="bargeObj.notifyUser" :placeholder="$t('请选择通知人')" :allUsers="this.$attrs.allUsers" />
huhaiqing's avatar
huhaiqing committed
20 21 22
            </el-form-item>
          </el-col>
        </el-row>
23 24
        <el-form-item :label="$t('驳船实际开船时间')" label-width="130px">
          <el-date-picker type="datetime" :placeholder="$t('请选择日期')" v-model="bargeObj.bgRealShipTime" value-format="yyyy-MM-dd HH:mm:ss"></el-date-picker>
huhaiqing's avatar
huhaiqing committed
25 26 27 28 29
        </el-form-item>
      </div>
    </el-form>

    <el-row class="operate-button">
30 31 32
      <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>
huhaiqing's avatar
huhaiqing committed
33 34 35 36 37
    </el-row>
  </div>
</template>

<script>
huhaiqing's avatar
huhaiqing committed
38
import { bargeCreate } from "@/api/ecw/boxSea";
huhaiqing's avatar
huhaiqing committed
39
import userSelect from "./common/userSelect.vue";
huhaiqing's avatar
huhaiqing committed
40
import { constantDict, formatDateStr, formatNumberString, serviceMsg } from "../utils";
huhaiqing's avatar
huhaiqing committed
41

huhaiqing's avatar
huhaiqing committed
42 43 44 45 46
/**
 * 驳船
 */
export default {
  name: "barge",
huhaiqing's avatar
huhaiqing committed
47
  inheritAttrs: false,
huhaiqing's avatar
huhaiqing committed
48
  components: { userSelect },
huhaiqing's avatar
huhaiqing committed
49 50 51 52
  data() {
    return {
      // 驳船对象
      bargeObj: {},
huhaiqing's avatar
huhaiqing committed
53 54
      // 驳船状态
      bargeStatus: constantDict.bgExmtStatus,
huhaiqing's avatar
huhaiqing committed
55 56
      // 校验
      rules: {
57
        bgExmtStatus: [{ required: true, message: this.$t("必填"), trigger: "change" }],
huhaiqing's avatar
huhaiqing committed
58
      },
huhaiqing's avatar
huhaiqing committed
59 60
    };
  },
huhaiqing's avatar
huhaiqing committed
61 62 63
  created() {
    const voName = this.$attrs.currNode.voName;
    let oldData = { ...this.$attrs.shipmentObj[voName] };
huhaiqing's avatar
huhaiqing committed
64 65
    oldData = formatDateStr(oldData, ["bgEstShipTime", "bgRealShipTime"]);
    oldData = formatNumberString(oldData, ["bgExmtStatus"]);
huhaiqing's avatar
huhaiqing committed
66 67
    this.bargeObj = oldData;
  },
huhaiqing's avatar
huhaiqing committed
68 69
  methods: {
    /** 提交 */
huhaiqing's avatar
huhaiqing committed
70
    onSubmit(operateType) {
huhaiqing's avatar
huhaiqing committed
71 72
      this.$refs["bargeForm"].validate((valid) => {
        if (valid) {
huhaiqing's avatar
huhaiqing committed
73 74 75 76 77 78
          bargeCreate({
            ...this.bargeObj,
            shipmentId: this.$attrs.shipmentObj.id,
            operateType,
          }).then((res) => {
            serviceMsg(res, this).then(() => {
huhaiqing's avatar
huhaiqing committed
79
              this.cancel("submit");
huhaiqing's avatar
huhaiqing committed
80 81
            });
          });
huhaiqing's avatar
huhaiqing committed
82 83 84 85
        }
      });
    },
    /** 取消 */
huhaiqing's avatar
huhaiqing committed
86 87
    cancel(type) {
      this.$emit("closeDialog", type);
huhaiqing's avatar
huhaiqing committed
88 89 90 91 92 93 94
    },
  },
};
</script>

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