Commit c822e2a2 authored by dragondean@qq.com's avatar dragondean@qq.com

修复偶发订单编辑路线回显失败

parent 45367f73
...@@ -550,6 +550,7 @@ import SupplierSelector from '@/components/SupplierSelector' ...@@ -550,6 +550,7 @@ import SupplierSelector from '@/components/SupplierSelector'
import Decimal from 'decimal.js' import Decimal from 'decimal.js'
import WorkFlow from '@/components/WorkFlow' import WorkFlow from '@/components/WorkFlow'
import { getCustomer } from "@/api/ecw/customer"; import { getCustomer } from "@/api/ecw/customer";
import {debounce} from "@/utils";
// 缓存默认的表单数据 // 缓存默认的表单数据
let makeDefaultFormData = () => { let makeDefaultFormData = () => {
...@@ -783,7 +784,7 @@ export default { ...@@ -783,7 +784,7 @@ export default {
console.log('departureId', departureId) console.log('departureId', departureId)
this.getOpenedRouterList() this.getOpenedRouterList()
// 修改始发地后需要重新选择路线 // 修改始发地后需要重新选择路线
if(oldDepartureId && oldDepartureId != departureId){ if(oldDepartureId && oldDepartureId != departureId && !this.initing){
console.log('修改始发地,重置lineId', oldDepartureId, departureId) console.log('修改始发地,重置lineId', oldDepartureId, departureId)
this.$set(this.form, 'lineId', null) this.$set(this.form, 'lineId', null)
} }
...@@ -792,7 +793,7 @@ export default { ...@@ -792,7 +793,7 @@ export default {
'form.objectiveId'(objectiveId, oldObjectiveId){ 'form.objectiveId'(objectiveId, oldObjectiveId){
this.getOpenedRouterList() this.getOpenedRouterList()
// 修改目的地后需要重新选择路线 // 修改目的地后需要重新选择路线
if(oldObjectiveId && oldObjectiveId != objectiveId){ if(oldObjectiveId && oldObjectiveId != objectiveId && !this.initing){
console.log('修改目的地,重置lineId', oldObjectiveId, objectiveId) console.log('修改目的地,重置lineId', oldObjectiveId, objectiveId)
this.$set(this.form, 'lineId', null) this.$set(this.form, 'lineId', null)
} }
...@@ -810,7 +811,7 @@ export default { ...@@ -810,7 +811,7 @@ export default {
}) })
} }
// 更换运输方式之后,之前选择的路线会失效,需要重新选择 // 更换运输方式之后,之前选择的路线会失效,需要重新选择
if(oldTransportId && oldTransportId != transportId && transportId != this.selectedRouter?.transportType){ if(oldTransportId && oldTransportId != transportId && transportId != this.selectedRouter?.transportType && !this.initing){
console.log('重置路线',oldTransportId, transportId, this.selectedRouter?.transportType) console.log('重置路线',oldTransportId, transportId, this.selectedRouter?.transportType)
this.$set(this.form, 'lineId', undefined) this.$set(this.form, 'lineId', undefined)
} }
...@@ -922,6 +923,7 @@ export default { ...@@ -922,6 +923,7 @@ export default {
// console.warn('onTableMounted', e) // console.warn('onTableMounted', e)
}, },
getOrder(){ getOrder(){
this.initing = true
getUpdateInfo(this.$route.query.id).then(res => { getUpdateInfo(this.$route.query.id).then(res => {
this.form = Object.assign({}, {...res.data}, {orderItemVOList: []}) this.form = Object.assign({}, {...res.data}, {orderItemVOList: []})
...@@ -975,6 +977,7 @@ export default { ...@@ -975,6 +977,7 @@ export default {
// 如果已完成入仓,则需要监听必填内容,发生更改后需要填写审批表单 // 如果已完成入仓,则需要监听必填内容,发生更改后需要填写审批表单
this.$nextTick(() => { this.$nextTick(() => {
console.log('nextTick 订单渲染完成')
res.data.orderItemVOList.forEach(item => { res.data.orderItemVOList.forEach(item => {
item.prodAttrArr = item.prodAttrIds.split(',').filter(item => item != '').map(attrId => +attrId) item.prodAttrArr = item.prodAttrIds.split(',').filter(item => item != '').map(attrId => +attrId)
this.form.orderItemVOList.push({...item}) this.form.orderItemVOList.push({...item})
...@@ -990,6 +993,8 @@ export default { ...@@ -990,6 +993,8 @@ export default {
} }
this.initing = false this.initing = false
}) })
console.log('order数据加载成功')
}).catch(() => { }).catch(() => {
this.initing = false this.initing = false
}) })
...@@ -1095,21 +1100,23 @@ export default { ...@@ -1095,21 +1100,23 @@ export default {
}, },
// 获取路线 // 获取路线
getOpenedRouterList(){ getOpenedRouterList(){
debounce(() => {
let params = {} let params = {}
if(this.form.departureId){ if(this.form.departureId){
params.startCityId = this.form.departureId params.startCityId = this.form.departureId
} }
if(this.form.objectiveId){ if(this.form.objectiveId){
params.destCityId = this.form.objectiveId params.destCityId = this.form.objectiveId
} }
if(this.form.transportId){ if(this.form.transportId){
params.transportType = this.form.transportId params.transportType = this.form.transportId
} }
// 始发,目的和运输方式都没有的时候不获取 // 始发,目的和运输方式都没有的时候不获取
if(!params.startCityId && !params.destCityId && !params.transportType) return false if(!params.startCityId && !params.destCityId && !params.transportType) return false
getOpenedRouterList(params).then(res => this.routerList = res.data.filter(item => { getOpenedRouterList(params).then(res => this.routerList = res.data.filter(item => {
return this.exportCityIds.indexOf(item.startCityId) > -1 && this.importCityIds.indexOf(item.destCityId) > -1 return this.exportCityIds.indexOf(item.startCityId) > -1 && this.importCityIds.indexOf(item.destCityId) > -1
})) }))
}, 100, false)()
}, },
// 计算体积 // 计算体积
calcVolume(row){ calcVolume(row){
......
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