Commit 3fd048f0 authored by zhoutong's avatar zhoutong

修复多次到港清关

parent f941e5a5
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
reserve-keyword reserve-keyword
:filter-method="filterOrder" :filter-method="filterOrder"
:placeholder="$t('请输入订单号、提单号、唛头')" :placeholder="$t('请输入订单号、提单号、唛头')"
@change="selectOrderId"
> >
<el-option <el-option
v-for="(item) in statusOrderList" v-for="(item) in statusOrderList"
...@@ -60,7 +61,7 @@ import regError from "../../regError"; ...@@ -60,7 +61,7 @@ import regError from "../../regError";
import dayjs from "dayjs"; import dayjs from "dayjs";
import { arrivalCreate } from "@/api/ecw/boxSeaAir"; import { arrivalCreate } from "@/api/ecw/boxSeaAir";
import { shipmentOrderList } from "@/api/ecw/boxAir"; import { shipmentOrderList } from "@/api/ecw/boxAir";
import { formatDateStr, serviceMsg } from "../utils"; import { formatDateStr, serviceMsg, formatDate } from "../utils";
/** /**
* 到港 * 到港
...@@ -106,6 +107,7 @@ export default { ...@@ -106,6 +107,7 @@ export default {
dtRealHeadTimeFlag: false, dtRealHeadTimeFlag: false,
orderList: [], orderList: [],
orderListFilter: [], orderListFilter: [],
arrivalOrderList: []
}; };
}, },
created() { created() {
...@@ -121,7 +123,8 @@ export default { ...@@ -121,7 +123,8 @@ export default {
this.dtRealHeadTimeFlag = true this.dtRealHeadTimeFlag = true
} }
if(!this.airArrivalInfo.arriveType) this.$set(this.airArrivalInfo,'arriveType',0) if(!this.airArrivalInfo.arriveType) this.$set(this.airArrivalInfo,'arriveType',0)
if(this.airArrivalInfo.arrivalOrderList) this.$set(this.airArrivalInfo,'arriveOrderIdList',this.airArrivalInfo.arrivalOrderList.map(item=>{return item.orderId})) if(this.airArrivalInfo.arrivalOrderList) this.$set(this.airArrivalInfo,'arriveOrderIdList',[])
if(this.$attrs.shipmentObj.airArrivalInfo.arrivalOrderList) this.arrivalOrderList = this.$attrs.shipmentObj.airArrivalInfo.arrivalOrderList
shipmentOrderList(this.$attrs.shipmentObj.id).then(r=>{ shipmentOrderList(this.$attrs.shipmentObj.id).then(r=>{
this.orderList = r.data this.orderList = r.data
this.orderListFilter = r.data this.orderListFilter = r.data
...@@ -137,7 +140,7 @@ export default { ...@@ -137,7 +140,7 @@ export default {
tidanNo: item.tidanNo, tidanNo: item.tidanNo,
marks: item.marks, marks: item.marks,
} }
let index = this.airArrivalInfo.arrivalOrderLis?this.airArrivalInfo.arrivalOrderList.findIndex(p=>p.orderId==item.orderId):-1 let index = this.arrivalOrderList.findIndex(p=>p.orderId==item.orderId)
if(index != -1){ if(index != -1){
json.arrival = this.$t('已到港') json.arrival = this.$t('已到港')
}else{ }else{
...@@ -177,6 +180,20 @@ export default { ...@@ -177,6 +180,20 @@ export default {
this.orderListFilter = this.orderList this.orderListFilter = this.orderList
} }
}, },
selectOrderId(val) {
if (val.length == 1) {
let arr = this.arrivalOrderList.find((item) => item.orderId == val[0])
if (arr) {
this.$set(this.airArrivalInfo, 'actSecondTime', formatDate(arr.actSecondTime))
this.$set(this.airArrivalInfo, 'estTime', formatDate(arr.estTime))
this.$set(this.airArrivalInfo, 'actTime', formatDate(arr.actTime))
}
} else {
this.$set(this.airArrivalInfo, 'actSecondTime', null)
this.$set(this.airArrivalInfo, 'estTime', null)
this.$set(this.airArrivalInfo, 'actTime', null)
}
},
regCloseDialog(type) { regCloseDialog(type) {
this.dialogVisible = false; this.dialogVisible = false;
if (type === "error") { if (type === "error") {
......
...@@ -8,80 +8,65 @@ ...@@ -8,80 +8,65 @@
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item :label="$t('选择订单')" prop="clearanceOrderIdList" v-show="cusClearanceObj.clearanceType == 1"> <el-form-item :label="$t('选择订单')" prop="clearanceOrderIdList" v-show="cusClearanceObj.clearanceType == 1">
<el-select <el-select v-model="cusClearanceObj.clearanceOrderIdList" multiple filterable clearable reserve-keyword :filter-method="filterOrder" :placeholder="$t('请输入订单号、提单号、唛头')" @change="selectOrderId">
v-model="cusClearanceObj.clearanceOrderIdList" <el-option v-for="item in statusOrderList" :key="item.orderId" :label="item.orderNo + ' ' + item.arrival" :value="item.orderId"> </el-option>
multiple
filterable
clearable
reserve-keyword
:filter-method="filterOrder"
:placeholder="$t('请输入订单号、提单号、唛头')"
>
<el-option
v-for="(item) in statusOrderList"
:key="item.orderId"
:label="item.orderNo+' '+item.arrival"
:value="item.orderId">
</el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item :label="$t('已清关订单')" v-show="cusClearanceObj.clearanceType == 1"> <el-form-item :label="$t('已清关订单')" v-show="cusClearanceObj.clearanceType == 1">
<span v-for="order in cusClearanceObj.clearanceOrderList" :key="order.id">{{order.orderNo}} </span> <span v-for="order in cusClearanceObj.clearanceOrderList" :key="order.id">{{ order.orderNo }} </span>
</el-form-item> </el-form-item>
<el-card v-for="order in cusClearanceObj.clearanceOrderIdList" :key="order" style="margin: 20px;"> <div v-if="cusClearanceObj.clearanceOrderIdList.length > 0">
<el-form-item v-if="cusClearanceObj.clearanceType==1" :label="$t('订单号')"> <el-form-item :label="$t('实际二程起飞时间')" prop="actSecondTime">
{{arrivalOrderList.find(item=>item.orderId==order).orderNo}} <el-date-picker type="datetime" :placeholder="$t('请选择日期')" v-model="airArrivalInfo.actSecondTime" value-format="yyyy-MM-dd HH:mm:ss"></el-date-picker>
</el-form-item> </el-form-item>
<el-form-item v-if="cusClearanceObj.clearanceType==1" :label="$t('实际二程起飞时间')" prop="actSecondTime"> <el-form-item :label="$t('预计到港时间')" prop="estTime">
{{formatDate(arrivalOrderList.find(item=>item.orderId==order).actSecondTime)}} <el-date-picker type="datetime" :placeholder="$t('请选择日期')" v-model="airArrivalInfo.estTime" value-format="yyyy-MM-dd HH:mm:ss"></el-date-picker>
</el-form-item> </el-form-item>
<el-form-item v-if="cusClearanceObj.clearanceType==1" :label="$t('预计到港时间')" prop="estTime"> <el-form-item :label="$t('实际到港时间')" prop="actTime">
{{formatDate(arrivalOrderList.find(item=>item.orderId==order).estTime)}} <el-date-picker type="datetime" :placeholder="$t('请选择日期')" v-model="airArrivalInfo.actTime" value-format="yyyy-MM-dd HH:mm:ss"></el-date-picker>
</el-form-item> </el-form-item>
<el-form-item v-if="cusClearanceObj.clearanceType==1" :label="$t('实际到港时间')" prop="actTime"> </div>
{{formatDate(arrivalOrderList.find(item=>item.orderId==order).actTime)}}
</el-form-item>
</el-card>
<el-form-item :label="$t('预计清关时间')" prop="clEstTime"> <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-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>
<el-form-item :label="$t('清关时间')" prop="clClearTime"> <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> <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> <p class="message-area" v-show="showMsg">{{ $t('清关时间与预计时间不符,如有异常请登记') }}</p>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-row class="operate-button"> <el-row class="operate-button">
<el-button type="primary" @click="onSubmit(1)">{{$t('保存')}}</el-button> <el-button type="primary" @click="onSubmit(1)">{{ $t('保存') }}</el-button>
<el-button type="success" @click="onSubmit(2)">{{$t('提交')}}</el-button> <el-button type="success" @click="onSubmit(2)">{{ $t('提交') }}</el-button>
<el-button @click="cancel">{{$t('关闭')}}</el-button> <el-button @click="cancel">{{ $t('关闭') }}</el-button>
<el-button type="primary" @click="exceptionReg" :disabled="!showMsg">{{$t('异常登记')}}</el-button> <el-button type="primary" @click="exceptionReg" :disabled="!showMsg">{{ $t('异常登记') }}</el-button>
</el-row> </el-row>
<!-- 对话框 --> <!-- 对话框 -->
<el-dialog custom-class="shipping-dialog" :title="$t('票异常')" :visible.sync="dialogVisible" width="700px" :modal-append-to-body=false append-to-body destroy-on-close> <el-dialog custom-class="shipping-dialog" :title="$t('票异常')" :visible.sync="dialogVisible" width="700px" :modal-append-to-body="false" append-to-body destroy-on-close>
<regError @closeDialog="dialogVisible = false" v-bind="$attrs" /> <regError @closeDialog="dialogVisible = false" v-bind="$attrs" />
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
<script> <script>
import regError from "../../regError"; import regError from '../../regError'
import dayjs from "dayjs"; import dayjs from 'dayjs'
import { clearanceCreate } from "@/api/ecw/boxSea"; import { clearanceCreate } from '@/api/ecw/boxSea'
import { shipmentOrderList } from "@/api/ecw/boxAir"; import { shipmentOrderList } from '@/api/ecw/boxAir'
import { formatDateStr, serviceMsg, formatDate } from "../utils"; import { formatDateStr, serviceMsg, formatDate } from '../utils'
import { updateOrderArrival } from "@/api/ecw/boxAir";
/** /**
* 清关 * 清关
*/ */
export default { export default {
name: "cusClearance", name: 'cusClearance',
inheritAttrs: false, inheritAttrs: false,
components: { components: {
regError, regError
}, },
data() { data() {
return { return {
...@@ -89,12 +74,8 @@ export default { ...@@ -89,12 +74,8 @@ export default {
cusClearanceObj: {}, cusClearanceObj: {},
// 校验 // 校验
rules: { rules: {
clEstTime: [ clEstTime: [{ required: true, message: this.$t('必填'), trigger: 'change' }],
{ required: true, message: this.$t("必填"), trigger: "change" }, clClearTime: [{ required: true, message: this.$t('必填'), trigger: 'change' }]
],
clClearTime: [
{ required: true, message: this.$t("必填"), trigger: "change" },
],
}, },
// 弹窗配置 // 弹窗配置
dialogVisible: false, dialogVisible: false,
...@@ -102,47 +83,48 @@ export default { ...@@ -102,47 +83,48 @@ export default {
showMsg: false, showMsg: false,
orderList: [], orderList: [],
orderListFilter: [], orderListFilter: [],
arrivalOrderList: [] arrivalOrderList: [],
}; airArrivalInfo: {}
}
}, },
created() { created() {
const voName = this.$attrs.currNode.voName; const voName = this.$attrs.currNode.voName
let oldData = { ...this.$attrs.shipmentObj[voName] }; let oldData = { ...this.$attrs.shipmentObj[voName] }
oldData = formatDateStr(oldData, ["clEstTime"]); oldData = formatDateStr(oldData, ['clEstTime'])
oldData = formatDateStr(oldData, ["clClearTime"], "YYYY-MM-DD HH:mm:ss"); oldData = formatDateStr(oldData, ['clClearTime'], 'YYYY-MM-DD HH:mm:ss')
this.cusClearanceObj = oldData; this.cusClearanceObj = oldData
if(!this.cusClearanceObj.clearanceType) this.$set(this.cusClearanceObj,'clearanceType',0) if (!this.cusClearanceObj.clearanceType) this.$set(this.cusClearanceObj, 'clearanceType', 0)
if(this.cusClearanceObj.clearanceOrderList) this.$set(this.cusClearanceObj,'clearanceOrderIdList',this.cusClearanceObj.clearanceOrderList.map(item=>{return item.orderId})) if (this.cusClearanceObj.clearanceOrderList) this.$set(this.cusClearanceObj, 'clearanceOrderIdList', [])
this.arrivalOrderList = this.$attrs.shipmentObj.airArrivalInfo.arrivalOrderList if(this.$attrs.shipmentObj.airArrivalInfo.arrivalOrderList) this.arrivalOrderList = this.$attrs.shipmentObj.airArrivalInfo.arrivalOrderList
shipmentOrderList(this.$attrs.shipmentObj.id).then(r=>{ shipmentOrderList(this.$attrs.shipmentObj.id).then((r) => {
this.orderList = r.data this.orderList = r.data
this.orderListFilter = r.data this.orderListFilter = r.data
}) })
}, },
watch: { watch: {
// 预计清关时间 // 预计清关时间
"cusClearanceObj.clEstTime"(val) { 'cusClearanceObj.clEstTime'(val) {
this.compareDate(val, this.cusClearanceObj.clClearTime); this.compareDate(val, this.cusClearanceObj.clClearTime)
}, },
// 清关时间 // 清关时间
"cusClearanceObj.clClearTime"(val) { 'cusClearanceObj.clClearTime'(val) {
this.compareDate(this.cusClearanceObj.clEstTime, val); this.compareDate(this.cusClearanceObj.clEstTime, val)
}, }
}, },
computed: { computed: {
statusOrderList(){ statusOrderList() {
let data = [] let data = []
this.orderListFilter.forEach(item=>{ this.orderListFilter.forEach((item) => {
let json = { let json = {
orderId: item.orderId, orderId: item.orderId,
orderNo: item.orderNo, orderNo: item.orderNo,
tidanNo: item.tidanNo, tidanNo: item.tidanNo,
marks: item.marks, marks: item.marks
} }
let index = this.cusClearanceObj.clearanceOrderList?this.cusClearanceObj.clearanceOrderList.findIndex(p=>p.orderId==item.orderId):-1 let index = this.cusClearanceObj.clearanceOrderList ? this.cusClearanceObj.clearanceOrderList.findIndex((p) => p.orderId == item.orderId) : -1
if(index != -1){ if (index != -1) {
json.arrival = this.$t('已清关') json.arrival = this.$t('已清关')
}else{ } else {
json.arrival = this.$t('未清关') json.arrival = this.$t('未清关')
} }
data.push(json) data.push(json)
...@@ -152,63 +134,81 @@ export default { ...@@ -152,63 +134,81 @@ export default {
}, },
methods: { methods: {
formatDate, formatDate,
filterOrder(val){ filterOrder(val) {
if(val != ''){ if (val != '') {
this.orderListFilter = this.orderList.filter(item=>{ this.orderListFilter = this.orderList.filter((item) => {
return item.orderNo.indexOf(val) > -1 || item.tidanNo.indexOf(val) > -1 || item.marks.indexOf(val) > -1 return item.orderNo.indexOf(val) > -1 || item.tidanNo.indexOf(val) > -1 || item.marks.indexOf(val) > -1
}) })
}else{ } else {
this.orderListFilter = this.orderList this.orderListFilter = this.orderList
} }
}, },
selectOrderId(val) {
if (val.length == 1) {
let arr = this.arrivalOrderList.find((item) => item.orderId == val[0])
if (arr) {
this.$set(this.airArrivalInfo, 'actSecondTime', formatDate(arr.actSecondTime))
this.$set(this.airArrivalInfo, 'estTime', formatDate(arr.estTime))
this.$set(this.airArrivalInfo, 'actTime', formatDate(arr.actTime))
}
} else {
this.$set(this.airArrivalInfo, 'actSecondTime', null)
this.$set(this.airArrivalInfo, 'estTime', null)
this.$set(this.airArrivalInfo, 'actTime', null)
}
},
getClAgent(type) { getClAgent(type) {
const agentId = this.$attrs.shipmentObj.agentInfo.agentId; const agentId = this.$attrs.shipmentObj.agentInfo.agentId
if (type === "label") { if (type === 'label') {
const selected = this.$attrs.allSupplier.find( const selected = this.$attrs.allSupplier.find((item) => item.id === agentId)
(item) => item.id === agentId return this.$l(selected, 'company') ?? agentId
);
return this.$l(selected, "company") ?? agentId;
} }
return agentId; return agentId
}, },
// 时间比较 // 时间比较
compareDate(clEstTime, clClearTime) { compareDate(clEstTime, clClearTime) {
this.showMsg = false; this.showMsg = false
let date1 = null, let date1 = null,
date2 = null; date2 = null
if (clEstTime) date1 = dayjs(clEstTime); if (clEstTime) date1 = dayjs(clEstTime)
if (clClearTime) date2 = dayjs(clClearTime); if (clClearTime) date2 = dayjs(clClearTime)
if (date1 && date2 && !date2.isSame(date1)) { if (date1 && date2 && !date2.isSame(date1)) {
this.showMsg = true; this.showMsg = true
} }
}, },
// 异常登记 // 异常登记
exceptionReg() { exceptionReg() {
this.dialogVisible = true; this.dialogVisible = true
}, },
/** 提交 */ /** 提交 */
onSubmit(operateType) { onSubmit(operateType) {
this.$refs["cusClearanceForm"].validate((valid) => { this.$refs['cusClearanceForm'].validate((valid) => {
if (valid) { if (valid) {
clearanceCreate({ updateOrderArrival({
...this.cusClearanceObj, ...this.airArrivalInfo,
shipmentId: this.$attrs.shipmentObj.id, shipmentId: this.$attrs.shipmentObj.id,
clAgentId: this.getClAgent(), orderIdList: this.cusClearanceObj.clearanceOrderIdList
operateType, }).then(() => {
}).then((res) => { clearanceCreate({
serviceMsg(res, this).then(() => { ...this.cusClearanceObj,
this.cancel("submit"); shipmentId: this.$attrs.shipmentObj.id,
}); clAgentId: this.getClAgent(),
}); operateType
}).then((res) => {
serviceMsg(res, this).then(() => {
this.cancel('submit')
})
})
})
} }
}); })
}, },
/** 取消 */ /** 取消 */
cancel(type) { cancel(type) {
this.$emit("closeDialog", type); this.$emit('closeDialog', type)
}, }
}, }
}; }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment