cancelClear.vue 2.79 KB
Newer Older
lanbaoming's avatar
lanbaoming committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
<template>
  <div class="shipping-update-error">
    <div class="message-title">{{$t(`您确定撤销${cancelClearInfo.orderNo}已清关状态吗?`)}}</div>
    <el-form ref="arrivalForm" :rules="rules" :model="cusClearanceObj" label-width="120px">
      <el-form-item :label="$t('撤销理由')" prop="clEstTime">
        <el-input v-if="!flag" v-model="cusClearanceObj.applyReason" type="textarea" :rows="4"></el-input>
        <template v-else>
          {{apply.applyReason}}
        </template>
      </el-form-item>
    </el-form>

    <el-row class="operate-button">
      <el-button v-if="!flag" type="primary" @click="onSubmit">{{$t('确定')}}</el-button>
      <el-button v-if="flag" type="primary" @click="$router.push({path: '/bpm/process-instance/detail', query: {id: apply.bpmProcessId}})">{{$t('审核中')}}</el-button>
      <el-button v-if="flag" plain type="primary" @click="canclAudit">{{$t('取消审核')}}</el-button>
      <el-button @click="cancel">{{$t('取消')}}</el-button>
    </el-row>
  </div>
</template>

<script>
import { approvalCreate } from "@/api/ecw/boxSea";
import {cancelProcessInstance} from "@/api/bpm/processInstance";

export default {
  name: "updateError",
  inheritAttrs: false,
  components: {},
  props: {
    shipmentObj: Object,
    cancelClearInfo: Object,
  },
  data() {
    return {
      // 到港对象
      cusClearanceObj: {},
      // 校验
      rules: {
        applyReason: [
          { required: true, message: this.$t("必填"), trigger: "change" },
        ]
      },
      apply: {},
      flag: false
    };
  },
  created() {
    let orders = this.shipmentObj.clearanceInfo?.clearanceOrderBackList
    let order = orders.find(item=>item.orderId == this.cancelClearInfo.orderId)
    console.log(order,11,this.cancelClearInfo.orderId,orders);
    if(order){
      this.apply = order
      if(this.apply.approvalStatus == 1){
        this.flag = true
      }
    }
  },
  methods: {
    onSubmit() {
      this.$refs["arrivalForm"].validate((valid) => {
        if (valid) {
          approvalCreate({
            shipmentId: this.shipmentObj.id,
            approvalStatus: 0,
            approvalType: 21,
            orderId: this.cancelClearInfo.orderId,
            applyReason: this.cusClearanceObj.applyReason
          }).then(()=>{
              this.$message.success("成功");
              this.cancel()
            })
        }
      });
    },
    /* 取消审核 */
    canclAudit() {
      cancelProcessInstance(this.apply.bpmProcessId, this.$t("取消审核")).then(() => {
        this.$emit("closeDialog","edit");
      });
    },
    cancel() {
      this.$emit("closeDialog","edit");
    },
  },
};
</script>

<style lang="scss" scoped>
.shipping-update-error {
  .message-title {
    text-align: center;
    font-size: 20px;
    margin: 0 20px 10px;
  }
}
</style>