台账列表

szh_zidingyibiaoti
lilu 2 years ago
parent 3bde9b353a
commit 00fb4a7392

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

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

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

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

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

Loading…
Cancel
Save