review.vue 2.44 KB
Newer Older
huhaiqing's avatar
huhaiqing committed
1 2 3 4
<template>
  <div>
    <el-form ref="reviewForm" :model="reviewObj" label-width="120px">
      <el-form-item label="申请理由">
huhaiqing's avatar
huhaiqing committed
5
        <el-input v-model="reviewObj.applyReason" type="textarea" rows="2" placeholder="请输入申请理由" :disabled="isReview"></el-input>
huhaiqing's avatar
huhaiqing committed
6 7 8
      </el-form-item>
    </el-form>
    <el-row class="operate-button">
huhaiqing's avatar
huhaiqing committed
9 10
      <el-button type="success" @click="onSubmit" :disabled="isReview">发起申请</el-button>
      <el-button type="primary" @click="jumpReviewDetail" :disabled="!isReview">审核中</el-button>
huhaiqing's avatar
huhaiqing committed
11 12 13 14 15 16
      <el-button @click="cancel">关闭</el-button>
    </el-row>
  </div>
</template>

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

/**
21
 * 反审
huhaiqing's avatar
huhaiqing committed
22 23 24 25 26 27 28 29
 */
export default {
  name: "review",
  inheritAttrs: false,
  data() {
    return {
      // 反审对象
      reviewObj: {},
huhaiqing's avatar
huhaiqing committed
30 31
      isReview: false,
      bpmProcessId: "",
huhaiqing's avatar
huhaiqing committed
32 33
    };
  },
huhaiqing's avatar
huhaiqing committed
34 35
  created() {
    const { currNode, shipmentObj } = this.$attrs;
36
    const { preInstallBackInfo, cabinetUnloadBackApprovalInfo } = shipmentObj;
huhaiqing's avatar
huhaiqing committed
37
    if (currNode.type === "preinstall") {
38 39 40 41 42
      this.isReview = preInstallBackInfo ? true : false;
      if (preInstallBackInfo && preInstallBackInfo.approvalStatus !== 1) {
        this.isReview = false;
      }
      this.bpmProcessId = preInstallBackInfo?.bpmProcessId;
huhaiqing's avatar
huhaiqing committed
43 44
    }
    if (currNode.type === "unloading") {
45 46 47 48 49
      this.isReview = cabinetUnloadBackApprovalInfo ? true : false;
      if (cabinetUnloadBackApprovalInfo && cabinetUnloadBackApprovalInfo.approvalStatus !== 1) {
        this.isReview = false;
      }
      this.bpmProcessId = cabinetUnloadBackApprovalInfo?.bpmProcessId;
huhaiqing's avatar
huhaiqing committed
50 51
    }
  },
huhaiqing's avatar
huhaiqing committed
52
  methods: {
huhaiqing's avatar
huhaiqing committed
53 54 55 56
    jumpReviewDetail() {
      toReviewDetail.apply(this, [this.bpmProcessId]);
      this.$emit("closeDialog");
    },
huhaiqing's avatar
huhaiqing committed
57 58 59 60
    /** 提交 */
    onSubmit() {
      this.$refs["reviewForm"].validate((valid) => {
        if (valid) {
61
          const { currNode, shipmentObj } = this.$attrs;
huhaiqing's avatar
huhaiqing committed
62
          approvalCreate({
63
            shipmentId: shipmentObj.id,
huhaiqing's avatar
huhaiqing committed
64
            ...this.reviewObj,
65
            approvalStatus: 0,
66
            approvalType: currNode.type === "preinstall" ? 4 : 7, // 4预装反审 7卸柜反审核
huhaiqing's avatar
huhaiqing committed
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
          }).then((res) => {
            serviceMsg(res, this).then(() => {
              this.cancel("submit");
            });
          });
        }
      });
    },
    /** 取消 */
    cancel(type) {
      this.$emit("closeDialog", type);
    },
  },
};
</script>