<template> <div class="shipping-update-error"> <div class="message-title">{{headerTitle}}</div> <el-form ref="arrivalForm" :rules="rules" :model="cusClearanceObj" label-width="120px"> <el-form-item :label="$t('预计清关时间')" prop="clEstTime"> <el-date-picker type="datetime" :placeholder="$t('请选择日期')" v-model="cusClearanceObj.clEstTime" value-format="yyyy-MM-dd HH:mm:ss"></el-date-picker> </el-form-item> <el-form-item :label="$t('清关时间')" prop="clClearTime"> <el-date-picker type="datetime" :placeholder="$t('请选择日期')" v-model="cusClearanceObj.clClearTime" value-format="yyyy-MM-dd HH:mm:ss"></el-date-picker> <p class="message-area" v-show="showMsg">{{$t('清关时间与预计时间不符,如有异常请登记')}}</p> </el-form-item> </el-form> <el-row class="operate-button"> <el-button type="primary" @click="onSubmit">{{$t('确定')}}</el-button> <el-button @click="cancel">{{$t('取消')}}</el-button> </el-row> </div> </template> <script> import { updateOrderClearance, updateAllOrderClearance } from "@/api/ecw/boxAir"; export default { name: "updateError", inheritAttrs: false, components: {}, props: { shipmentObj: Object, clearInfo: Object, }, data() { return { // 到港对象 cusClearanceObj: {}, // 校验 rules: { clEstTime: [ { required: true, message: this.$t("必填"), trigger: "change" }, ], clClearTime: [ { required: true, message: this.$t("必填"), trigger: "change" }, ] }, headerTitle: "", }; }, watch: { clearInfo: { handler: function (val) { const { orderList, type } = val; if (type === "selected") { this.headerTitle = this.$t( "确定给{selfNo}下的{orderNos}更新状态吗?", { selfNo: this.shipmentObj.selfNo, orderNos: orderList.map((item) => item.orderNo).join(",") ?? "", } ); } else { this.headerTitle = this.$t( `确定给{selfNo}下的${ type === "all" ? this.$t("所有订单") : this.$t("所选订单") }更新状态吗?`, { selfNo: this.shipmentObj.selfNo, } ); } }, immediate: true, }, }, methods: { onSubmit() { this.$refs["arrivalForm"].validate((valid) => { if (valid) { if(this.clearInfo.type == 'selected'){ let param = { shipmentId: this.shipmentObj.id, orderIdList: this.clearInfo.orderList } updateOrderClearance({...this.cusClearanceObj, ...param}).then(()=>{ this.$message.success("成功"); this.cancel() }) }else{ let param = { shipmentId: this.shipmentObj.id } updateAllOrderClearance({...this.cusClearanceObj, ...param}).then(()=>{ this.$message.success("成功"); this.cancel() }) } } }); }, cancel() { this.$emit("closeDialog"); }, }, }; </script> <style lang="scss" scoped> .shipping-update-error { .message-title { text-align: center; font-size: 20px; margin: 0 20px 10px; } } </style>