|
|
|
@ -480,7 +480,7 @@ import {
|
|
|
|
|
|
|
|
|
|
import initData from './modules/initData'
|
|
|
|
|
import { DjyUserConfigGet, DjyUserConfigAdd } from '@/api/modular/main/DjyUserConfig'
|
|
|
|
|
import { mapActions } from 'vuex'
|
|
|
|
|
import { mapGetters, mapActions } from 'vuex'
|
|
|
|
|
const formInitData = [
|
|
|
|
|
{ title: '主提单号', align: 'center', width: '90', label: 'MBLNO', type: 'input' },
|
|
|
|
|
{ title: '分提单号', align: 'center', width: '90', label: 'HBLNO', type: 'input' },
|
|
|
|
@ -582,8 +582,12 @@ export default {
|
|
|
|
|
RecentlyCarrierData: []
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
computed: {
|
|
|
|
|
...mapGetters(['bookingList', 'bookingGridOptions'])
|
|
|
|
|
},
|
|
|
|
|
beforeRouteLeave (to, from, next) {
|
|
|
|
|
// console.log('路由离开')
|
|
|
|
|
this.setBookingGridOptions(this.gridOptions)
|
|
|
|
|
console.log('路由离开, 设置缓存', this.bookingGridOptions)
|
|
|
|
|
this.gridOptions = {
|
|
|
|
|
border: false,
|
|
|
|
|
resizable: true,
|
|
|
|
@ -610,18 +614,22 @@ export default {
|
|
|
|
|
beforeRouteEnter (to, from, next) {
|
|
|
|
|
// console.log('路由进入')
|
|
|
|
|
next(vm => {
|
|
|
|
|
console.log('== 进入路由 - beforeRouteEnter ==', vm.formRes)
|
|
|
|
|
vm.createdInit()
|
|
|
|
|
vm.onresize()
|
|
|
|
|
console.log('== 进入路由 - beforeRouteEnter ==', vm.bookingGridOptions)
|
|
|
|
|
if (Object.keys(vm.gridOptions).length > 0) {
|
|
|
|
|
vm.gridOptions = { ...vm.gridOptions, ...vm.bookingGridOptions }
|
|
|
|
|
}
|
|
|
|
|
// vm.createdInit()
|
|
|
|
|
// vm.onresize()
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
created() {
|
|
|
|
|
// this.createdInit()
|
|
|
|
|
this.createdInit()
|
|
|
|
|
},
|
|
|
|
|
mounted() {
|
|
|
|
|
// this.onresize()
|
|
|
|
|
this.onresize()
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
...mapActions(['setBookingList', 'setBookingGridOptions']),
|
|
|
|
|
createdInit () {
|
|
|
|
|
this.showColumns = JSON.parse(JSON.stringify(initData.columns))
|
|
|
|
|
this.formAllData = JSON.parse(JSON.stringify(initData.condAllData))
|
|
|
|
@ -719,7 +727,6 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
...mapActions(['setBookingList']),
|
|
|
|
|
FnCopy(data) {
|
|
|
|
|
const el = document.createElement('input')
|
|
|
|
|
el.setAttribute('value', data)
|
|
|
|
@ -869,7 +876,7 @@ export default {
|
|
|
|
|
})
|
|
|
|
|
console.log('== 获取到form, 准备获取列表 ==', isReset, this.formRes)
|
|
|
|
|
if (!isReset) {
|
|
|
|
|
this.getList(this.formRes)
|
|
|
|
|
this.getList(this.formRes, true)
|
|
|
|
|
}
|
|
|
|
|
const len = this.formData.length % 4
|
|
|
|
|
if (this.formData.length === 4 || this.formData.length > 4) {
|
|
|
|
@ -911,7 +918,6 @@ export default {
|
|
|
|
|
setPageSize (data) {
|
|
|
|
|
if (data && JSON.parse(data.configJson)) {
|
|
|
|
|
this.gridOptions.pagerConfig.pageSize = JSON.parse(data.configJson).pageSize
|
|
|
|
|
this.getList(this.formRes)
|
|
|
|
|
this.$forceUpdate()
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
@ -919,59 +925,7 @@ export default {
|
|
|
|
|
// 获取表单设置内容
|
|
|
|
|
getFormData(isReset = false) {
|
|
|
|
|
DjyUserConfigGet({ type: 'booking_list_cond' }).then(res => {
|
|
|
|
|
if (res.data && JSON.parse(res.data.configJson).length) {
|
|
|
|
|
const arr = JSON.parse(res.data.configJson)
|
|
|
|
|
const nowData = []
|
|
|
|
|
const moreData = []
|
|
|
|
|
arr.map((item, index) => {
|
|
|
|
|
this.formAllData.map((fitem, findex) => {
|
|
|
|
|
if (fitem.label === item) {
|
|
|
|
|
nowData.push(fitem)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
this.formAllData.map((item, index) => {
|
|
|
|
|
if (!arr.includes(item.label)) {
|
|
|
|
|
moreData.push(item)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
this.formData = nowData
|
|
|
|
|
this.formMoreData = moreData
|
|
|
|
|
} else {
|
|
|
|
|
const nowData = this.formData.map((item, index) => {
|
|
|
|
|
return item.label
|
|
|
|
|
})
|
|
|
|
|
const moreData = []
|
|
|
|
|
this.formAllData.map((item, index) => {
|
|
|
|
|
if (!nowData.includes(item.label)) {
|
|
|
|
|
moreData.push(item)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
this.formMoreData = moreData
|
|
|
|
|
}
|
|
|
|
|
this.formData.map((item, index) => {
|
|
|
|
|
this.$set(this.formRes, item.label, this.formRes[item.label] || '')
|
|
|
|
|
// select 船公司 等获取下拉列表
|
|
|
|
|
if (item.type === 'select') {
|
|
|
|
|
if (['NOBILL', 'CARGOID'].includes(item.label)) {
|
|
|
|
|
item.dataList = item.data
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
this.$refs[`fromlabel-${item.label}`][0].$data.dataList = item.data
|
|
|
|
|
}, 300)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
console.log('== 获取到form, 准备获取列表 ==', isReset, this.formRes)
|
|
|
|
|
if (!isReset) {
|
|
|
|
|
this.getList(this.formRes)
|
|
|
|
|
}
|
|
|
|
|
const len = this.formData.length % 4
|
|
|
|
|
if (this.formData.length === 4 || this.formData.length > 4) {
|
|
|
|
|
this.formBtnCol = 8
|
|
|
|
|
} else {
|
|
|
|
|
this.formBtnCol = 24 - len * 4
|
|
|
|
|
}
|
|
|
|
|
this.$forceUpdate()
|
|
|
|
|
this.setFormData(res.data)
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
emnuSelectApi(type) {
|
|
|
|
@ -1174,7 +1128,7 @@ export default {
|
|
|
|
|
editColumns(row) {
|
|
|
|
|
this.$router.push({ name: 'BookingDetail', query: { id: row.id, type: row.carrierid, mblno: row.mblno } })
|
|
|
|
|
},
|
|
|
|
|
getList(queryParam = {}) {
|
|
|
|
|
getList(queryParam = {}, isInit = false) {
|
|
|
|
|
this.$set(this.gridOptions, 'loading', true)
|
|
|
|
|
const { currentPage, pageSize } = this.gridOptions.pagerConfig
|
|
|
|
|
const query = {
|
|
|
|
@ -1201,8 +1155,14 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
BookingOrderPage(query)
|
|
|
|
|
.then(res => {
|
|
|
|
|
if (isInit) { this.getList(this.formRes) }
|
|
|
|
|
if (res.success) {
|
|
|
|
|
let newBookingList = {}
|
|
|
|
|
if (query.PageNo !== 1) {
|
|
|
|
|
newBookingList = this.bookingList
|
|
|
|
|
}
|
|
|
|
|
const _data = res.data.items.map((item, index) => {
|
|
|
|
|
this.$set(newBookingList, item.id, item)
|
|
|
|
|
item.index = (currentPage - 1) * pageSize + index
|
|
|
|
|
const bookstatus = [
|
|
|
|
|
{ staCode: 'sta_cangdan', isChecked: false },
|
|
|
|
@ -1229,11 +1189,8 @@ export default {
|
|
|
|
|
this.$set(this.gridOptions, 'data', [..._data])
|
|
|
|
|
this.$set(this.gridOptions.pagerConfig, 'total', res.data.totalCount)
|
|
|
|
|
this.$set(this.gridOptions, 'loading', false)
|
|
|
|
|
const bookingList = {}
|
|
|
|
|
this.gridOptions.data.map(($item, $index) => {
|
|
|
|
|
this.$set(bookingList, $item.id, $item)
|
|
|
|
|
})
|
|
|
|
|
this.setBookingList(bookingList)
|
|
|
|
|
this.setBookingList(newBookingList)
|
|
|
|
|
console.log(this.gridOptions.data.length, Object.keys(newBookingList).length, this.gridOptions.data, newBookingList)
|
|
|
|
|
this.$forceUpdate()
|
|
|
|
|
} else {
|
|
|
|
|
this.$set(this.gridOptions, 'data', [...[]])
|
|
|
|
|