台账列表

szh_zidingyibiaoti
lilu 2 years ago
parent 3bde9b353a
commit 00fb4a7392

@ -17,6 +17,7 @@ const getters = {
multiTab: state => state.app.multiTab,
lang: state => state.i18n.lang,
bookingList: state => state.user.bookingList,
bookingGridOptions: state => state.user.bookingGridOptions,
needSavePages: state => state.user.needSavePages,
hasbookingDetail: state => state.user.hasbookingDetail
}

@ -20,7 +20,8 @@ const user = {
roles: [],
info: {},
notices: [], // 接收的通知公告
bookingList: {}, // 订舱台账列表
bookingList: {}, // 订舱台账列表 (全部列表对象)
bookingGridOptions: {}, // 订舱台账列表
needSavePages: {}, // 需要保存的页面
hasbookingDetail: false // 订舱详情是否销毁
},
@ -76,6 +77,9 @@ const user = {
SET_BOOKINGLIST: (state, list) => {
state.bookingList = list
},
SET_BOOKINGGRIDOPTIONS: (state, obj) => {
state.bookingGridOptions = obj
},
SET_NEEDSAVEPAGES: (state, list) => {
state.needSavePages = list
},
@ -270,6 +274,13 @@ const user = {
})
},
setBookingGridOptions({ commit }, obj) {
return new Promise(resolve => {
commit('SET_BOOKINGGRIDOPTIONS', obj)
resolve()
})
},
// 设置需要保存页面
setNeedSavePages({ commit }, obj) {
return new Promise(resolve => {

@ -397,7 +397,6 @@
has-feedback
>
<div class="box-flex">
<a-textarea
class="remark-input"
style="width:1000px !important; text-align: left;"

@ -302,7 +302,6 @@ export default {
this.id = this.$route.query.id
if (!nD.id) {
//
this.BookingDetail = []
} else if (nD.id && this.$route.name === 'BookingDetail') {
// this.init()
}

@ -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', [...[]])

Loading…
Cancel
Save