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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<template>
<div>
<el-form ref="reviewForm" :model="reviewObj" label-width="120px">
<el-form-item :label="$t('申请理由')">
<el-input v-model="reviewObj.applyReason" type="textarea" rows="2" :placeholder="$t('请输入申请理由')" :disabled="isReview"></el-input>
</el-form-item>
<span v-if="voKey=='preInstallBackInfo'" style="color: red;margin-left: 120px;">{{$t('请注意,分拣反审后,全部提单需重新制作')}}</span>
</el-form>
<work-flow v-if="xmlKey" :xmlkey="xmlKey" v-model="copyUserId"></work-flow>
<el-row class="operate-button">
<el-button type="success" @click="onSubmit" v-show="!isReview">{{$t('发起申请')}}</el-button>
<el-button type="primary" @click="jumpReviewDetail" v-show="isReview">{{$t('审核中')}}</el-button>
<el-button plain type="primary" @click="canclAudit" v-show="isReview">{{$t('取消审核')}}</el-button>
<el-button @click="cancel">{{$t('关闭')}}</el-button>
</el-row>
</div>
</template>
<script>
import { approvalCreate, approvalCancel } from "@/api/ecw/boxSea";
import { serviceMsg, toReviewDetail } from "../utils";
import WorkFlow from "@/components/WorkFlow/index.vue";
/**
* 反审
*/
export default {
name: "review",
inheritAttrs: false,
components: {WorkFlow},
data() {
return {
// 反审对象
reviewObj: {},
isReview: false,
bpmProcessId: "",
voKey: "",
copyUserId: [], // 抄送人
};
},
computed:{
type(){
return this.$attrs.currNode?.type
},
xmlKey(){
if(!this.type) return null
return {
// 出货反审核
'shipment': 'shipment_audit_no'
}[this.type]
}
},
created() {
const { currNode, shipmentObj } = this.$attrs;
let voKey = "";
switch (currNode.type) {
case "preinstall":
voKey = "preInstallBackInfo";
break;
case "cabinet":
voKey = "cabinetBackInfo";
break;
case "unloading":
voKey = "cabinetUnloadBackApprovalInfo";
break;
case "shipment":
voKey = "airShipmentBackApprovalInfo";
}
if (voKey) {
this.isReview = shipmentObj[voKey] ? true : false;
if (shipmentObj[voKey] && shipmentObj[voKey].approvalStatus !== 1) {
this.isReview = false;
}
if (shipmentObj[voKey]) {
this.bpmProcessId = shipmentObj[voKey].bpmProcessId;
}
if (this.isReview) {
this.$set(
this.reviewObj,
"applyReason",
shipmentObj[voKey].applyReason
);
}
}
this.voKey = voKey;
},
methods: {
/* 取消审核 */
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");
});
});
},
jumpReviewDetail() {
toReviewDetail.apply(this, [this.bpmProcessId]);
this.$emit("closeDialog");
},
/** 提交 */
onSubmit() {
this.$refs["reviewForm"].validate((valid) => {
if (valid) {
const { currNode, shipmentObj } = this.$attrs;
let approvalType = 14; // 预装反审
if (currNode.type === "cabinet") approvalType = 9; // 装柜反审
if (currNode.type === "unloading") approvalType = 16; // 到仓反审核
if(currNode.type === "shipment") approvalType = 19; // 出货反审核
approvalCreate({
shipmentId: shipmentObj.id,
...this.reviewObj,
approvalStatus: 0,
approvalType,
}).then((res) => {
serviceMsg(res, this).then(() => {
this.cancel("submit");
});
});
}
});
},
/** 取消 */
cancel(type) {
this.$emit("closeDialog", type);
},
},
};
</script>