review.vue 3.37 KB
Newer Older
huhaiqing's avatar
huhaiqing committed
1 2 3
<template>
  <div>
    <el-form ref="reviewForm" :model="reviewObj" label-width="120px">
4 5
      <el-form-item :label="$t('申请理由')">
        <el-input v-model="reviewObj.applyReason" type="textarea" rows="2" :placeholder="$t('请输入申请理由')" :disabled="isReview"></el-input>
huhaiqing's avatar
huhaiqing committed
6
      </el-form-item>
7
      <span v-if="voKey=='preInstallBackInfo'" style="color: red;margin-left: 120px;">{{$t('请注意,预装反审后,全部提单需重新制作')}}</span>
huhaiqing's avatar
huhaiqing committed
8 9
    </el-form>
    <el-row class="operate-button">
10 11
      <el-button type="success" @click="onSubmit" v-show="!isReview">{{$t('发起申请')}}</el-button>
      <el-button type="primary" @click="jumpReviewDetail" v-show="isReview">{{$t('审核中')}}</el-button>
huhaiqing's avatar
huhaiqing committed
12
      <el-button plain type="primary" @click="canclAudit" v-show="isReview">{{$t('取消审核')}}</el-button>
13
      <el-button @click="cancel">{{$t('关闭')}}</el-button>
huhaiqing's avatar
huhaiqing committed
14 15 16 17 18
    </el-row>
  </div>
</template>

<script>
huhaiqing's avatar
huhaiqing committed
19
import { approvalCreate, approvalCancel } from "@/api/ecw/boxSea";
huhaiqing's avatar
huhaiqing committed
20
import { serviceMsg, toReviewDetail } from "../utils";
huhaiqing's avatar
huhaiqing committed
21 22

/**
23
 * 反审
huhaiqing's avatar
huhaiqing committed
24 25 26 27 28 29 30 31
 */
export default {
  name: "review",
  inheritAttrs: false,
  data() {
    return {
      // 反审对象
      reviewObj: {},
huhaiqing's avatar
huhaiqing committed
32 33
      isReview: false,
      bpmProcessId: "",
huhaiqing's avatar
huhaiqing committed
34
      voKey: "",
huhaiqing's avatar
huhaiqing committed
35 36
    };
  },
huhaiqing's avatar
huhaiqing committed
37 38
  created() {
    const { currNode, shipmentObj } = this.$attrs;
huhaiqing's avatar
huhaiqing committed
39 40 41 42 43 44 45 46 47 48 49 50

    let voKey = "";
    switch (currNode.type) {
      case "preinstall":
        voKey = "preInstallBackInfo";
        break;
      case "cabinet":
        voKey = "cabinetBackInfo";
        break;
      case "unloading":
        voKey = "cabinetUnloadBackApprovalInfo";
        break;
huhaiqing's avatar
huhaiqing committed
51
    }
huhaiqing's avatar
huhaiqing committed
52 53 54 55

    if (voKey) {
      this.isReview = shipmentObj[voKey] ? true : false;
      if (shipmentObj[voKey] && shipmentObj[voKey].approvalStatus !== 1) {
huhaiqing's avatar
huhaiqing committed
56 57
        this.isReview = false;
      }
huhaiqing's avatar
huhaiqing committed
58 59 60
      if (shipmentObj[voKey]) {
        this.bpmProcessId = shipmentObj[voKey].bpmProcessId;
      }
huhaiqing's avatar
huhaiqing committed
61 62 63 64 65 66
      if (this.isReview) {
        this.$set(
          this.reviewObj,
          "applyReason",
          shipmentObj[voKey].applyReason
        );
67
      }
huhaiqing's avatar
huhaiqing committed
68
    }
huhaiqing's avatar
huhaiqing committed
69
    this.voKey = voKey;
huhaiqing's avatar
huhaiqing committed
70
  },
huhaiqing's avatar
huhaiqing committed
71
  methods: {
huhaiqing's avatar
huhaiqing committed
72 73 74 75 76 77 78 79 80 81 82 83 84 85
    /* 取消审核 */
    canclAudit() {
      const { shipmentObj } = this.$attrs;

      approvalCancel({
        applyReason: this.$t("取消反审核"),
        id: shipmentObj[this.voKey].id,
        shipmentId: shipmentObj.id,
      }).then((res) => {
        serviceMsg(res, this).then(() => {
          this.$emit("closeDialog", "submit");
        });
      });
    },
huhaiqing's avatar
huhaiqing committed
86 87 88 89
    jumpReviewDetail() {
      toReviewDetail.apply(this, [this.bpmProcessId]);
      this.$emit("closeDialog");
    },
huhaiqing's avatar
huhaiqing committed
90 91 92 93
    /** 提交 */
    onSubmit() {
      this.$refs["reviewForm"].validate((valid) => {
        if (valid) {
94
          const { currNode, shipmentObj } = this.$attrs;
huhaiqing's avatar
huhaiqing committed
95 96 97 98
          let approvalType = 4; // 预装反审
          if (currNode.type === "cabinet") approvalType = 9; // 装柜反审
          if (currNode.type === "unloading") approvalType = 7; // 卸柜反审核

huhaiqing's avatar
huhaiqing committed
99
          approvalCreate({
100
            shipmentId: shipmentObj.id,
huhaiqing's avatar
huhaiqing committed
101
            ...this.reviewObj,
102
            approvalStatus: 0,
huhaiqing's avatar
huhaiqing committed
103
            approvalType,
huhaiqing's avatar
huhaiqing committed
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
          }).then((res) => {
            serviceMsg(res, this).then(() => {
              this.cancel("submit");
            });
          });
        }
      });
    },
    /** 取消 */
    cancel(type) {
      this.$emit("closeDialog", type);
    },
  },
};
</script>