修改订舱下拉数据

szh_zidingyibiaoti
lilu 2 years ago
parent 4bdf467a82
commit d262a7bc57

@ -61,7 +61,7 @@
<script> <script>
import { triggerWindowResizeEvent } from '@/utils/util' import { triggerWindowResizeEvent } from '@/utils/util'
import { mapState, mapActions } from 'vuex' import { mapState, mapActions, mapGetters } from 'vuex'
import { mixin, mixinDevice } from '@/utils/mixin' import { mixin, mixinDevice } from '@/utils/mixin'
import RouteView from './RouteView' import RouteView from './RouteView'
import SideMenu from '@/components/Menu/SideMenu' import SideMenu from '@/components/Menu/SideMenu'
@ -98,8 +98,8 @@ export default {
} }
return '80px' return '80px'
}, },
placeholderDivMinWidth(){ placeholderDivMinWidth() {
let width = this.collapsed?"80px":"230px"; let width = this.collapsed ? '80px' : '230px';
return width; return width;
} }
}, },
@ -128,9 +128,11 @@ export default {
}, 16) }, 16)
}) })
} }
console.log('== 1111进入页面 == ,这里添加获取订舱下拉数据 ')
this.setBookingInfo()
}, },
methods: { methods: {
...mapActions(['setSidebar']), ...mapActions(['setSidebar', 'setCarrierList', 'setYardList', 'setPackageList', 'setIssuetypeList', 'setBlfrtList', 'setCtnallList']),
// //
setMenus () { setMenus () {
const routes = convertRoutes(this.mainMenu.find(item => item.path === '/')) const routes = convertRoutes(this.mainMenu.find(item => item.path === '/'))
@ -154,6 +156,14 @@ export default {
}, },
drawerClose () { drawerClose () {
this.collapsed = false this.collapsed = false
},
setBookingInfo () {
this.setCarrierList()
this.setYardList()
this.setPackageList()
this.setIssuetypeList()
this.setBlfrtList()
this.setCtnallList()
} }
} }
} }

@ -19,7 +19,13 @@ const getters = {
bookingList: state => state.user.bookingList, bookingList: state => state.user.bookingList,
bookingGridOptions: state => state.user.bookingGridOptions, 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,
carrierList: state => state.booking.carrierList,
yardList: state => state.booking.yardList,
packageList: state => state.booking.packageList,
issuetypeList: state => state.booking.issuetypeList,
blfrtList: state => state.booking.blfrtList,
ctnallList: state => state.booking.ctnallList
} }
export default getters export default getters

@ -3,6 +3,7 @@ import Vuex from 'vuex'
import app from './modules/app' import app from './modules/app'
import user from './modules/user' import user from './modules/user'
import booking from './modules/booking'
// default router permission control // default router permission control
// import permission from './modules/permission' // import permission from './modules/permission'
@ -17,6 +18,7 @@ export default new Vuex.Store({
modules: { modules: {
app, app,
user, user,
booking,
permission permission
}, },
state: { state: {

@ -0,0 +1,171 @@
// import Vue from 'vue'
// import store from '../index' // 后期需要放开
// import router from '../../router'
import {
GetCarrierlist,
GetYardlist,
GetPackage,
Codeissuetypelist,
GetFrt,
GetCtn
} from '@/api/modular/main/BookingLedger'
const booking = {
state: {
// 订舱公共数据 - 下拉列表
carrierList: [],
yardList: [],
packageList: [],
issuetypeList: [],
blfrtList: [],
ctnallList: []
// 订舱公共数据 - 模糊搜索,默认获取前十条 (需要后台提供公共接口)
},
mutations: {
SET_CARRIERLIST: (state, list) => {
state.carrierList = list
},
SET_YARDLIST: (state, list) => {
state.yardList = list
},
SET_PACKAGELIST: (state, list) => {
state.packageList = list
},
SET_ISSUETYPELIST: (state, list) => {
state.issuetypeList = list
},
SET_BLFRTLIST: (state, list) => {
state.blfrtList = list
},
SET_CTNALLLIST: (state, list) => {
state.ctnallList = list
}
},
actions: {
// 设置船公司列表
setCarrierList({ commit }, obj) {
return new Promise(resolve => {
GetCarrierlist({
keyword: '',
type: 'consignor'
}).then(response => {
if (response.success) {
const data = response.data
commit('SET_CARRIERLIST', data)
resolve(response.data)
} else {
// eslint-disable-next-line no-undef
reject(new Error(data.message))
}
}).catch(error => {
// eslint-disable-next-line no-undef
reject(error)
})
})
},
// 设置场站列表
setYardList({ commit }, obj) {
return new Promise(resolve => {
GetYardlist({
keyword: ''
}).then(response => {
if (response.success) {
const data = response.data
commit('SET_YARDLIST', data)
resolve(response.data)
} else {
// eslint-disable-next-line no-undef
reject(new Error(data.message))
}
}).catch(error => {
// eslint-disable-next-line no-undef
reject(error)
})
})
},
// 设置包装列表
setPackageList({ commit }, obj) {
return new Promise(resolve => {
GetPackage({
keyword: ''
}).then(response => {
if (response.success) {
const data = response.data
commit('SET_PACKAGELIST', data)
resolve(response.data)
} else {
// eslint-disable-next-line no-undef
reject(new Error(data.message))
}
}).catch(error => {
// eslint-disable-next-line no-undef
reject(error)
})
})
},
// 设置签单方式列表
setIssuetypeList({ commit }, obj) {
return new Promise(resolve => {
Codeissuetypelist({
keyword: ''
}).then(response => {
if (response.success) {
const data = response.data
commit('SET_ISSUETYPELIST', data)
resolve(response.data)
} else {
// eslint-disable-next-line no-undef
reject(new Error(data.message))
}
}).catch(error => {
// eslint-disable-next-line no-undef
reject(error)
})
})
},
// 设置付费方式列表
setBlfrtList({ commit }, obj) {
return new Promise(resolve => {
GetFrt({
keyword: ''
}).then(response => {
if (response.success) {
const data = response.data
commit('SET_BLFRTLIST', data)
resolve(response.data)
} else {
// eslint-disable-next-line no-undef
reject(new Error(data.message))
}
}).catch(error => {
// eslint-disable-next-line no-undef
reject(error)
})
})
},
// 设置箱型列表
setCtnallList({ commit }, obj) {
return new Promise(resolve => {
GetCtn({
keyword: ''
}).then(response => {
if (response.success) {
const data = response.data
commit('SET_CTNALLLIST', data)
resolve(response.data)
} else {
// eslint-disable-next-line no-undef
reject(new Error(data.message))
}
}).catch(error => {
// eslint-disable-next-line no-undef
reject(error)
})
})
}
}
}
export default booking

@ -46,23 +46,24 @@
</template> </template>
<script> <script>
import { import {
GetYardlist, // GetYardlist,
GetPortloadlist, GetPortloadlist,
GetPortlist, GetPortlist,
BookingTemplate, BookingTemplate,
DjyCustomerpage, DjyCustomerpage,
GetPackage, // GetPackage,
DjyCustomerSuggest, DjyCustomerSuggest,
GetCarrierlist, // GetCarrierlist,
getContractno, getContractno,
getVesselInfoService, getVesselInfoService,
GetForwarderlist, GetForwarderlist,
GetSysUserPage, GetSysUserPage,
Codeissuetypelist, // Codeissuetypelist,
GetFrt, // GetFrt,
GetService, GetService,
getGoodsname getGoodsname
} from '@/api/modular/main/BookingLedger' } from '@/api/modular/main/BookingLedger'
import { mapGetters } from 'vuex'
let timer let timer
export default { export default {
name: '', name: '',
@ -108,6 +109,9 @@ export default {
clickHandle: null clickHandle: null
} }
}, },
computed: {
...mapGetters(['carrierList', 'yardList', 'packageList', 'issuetypeList', 'blfrtList'])
},
watch: { watch: {
defaultVal(nval, oval) { defaultVal(nval, oval) {
if (this.inEdit) { return false } if (this.inEdit) { return false }
@ -158,8 +162,8 @@ export default {
}, },
emnuSelectApi (type) { emnuSelectApi (type) {
switch (type) { switch (type) {
case 'GetYardlist': // case 'GetYardlist':
return GetYardlist // return GetYardlist
case 'GetPortloadlist': case 'GetPortloadlist':
return GetPortloadlist return GetPortloadlist
case 'GetPortlist': case 'GetPortlist':
@ -168,24 +172,25 @@ export default {
return BookingTemplate return BookingTemplate
case 'DjyCustomerpage': case 'DjyCustomerpage':
return DjyCustomerpage return DjyCustomerpage
case 'GetPackage': // case 'GetPackage':
return GetPackage // return GetPackage
case 'DjyCustomerSuggest': case 'DjyCustomerSuggest':
return DjyCustomerSuggest return DjyCustomerSuggest
case 'GetCarrierlist': // case 'GetCarrierlist':
return GetCarrierlist // return GetCarrierlist
case 'getContractno': case 'getContractno':
return getContractno return getContractno
case 'getVesselInfoService': case 'getVesselInfoService':
//
return getVesselInfoService return getVesselInfoService
case 'GetForwarderlist': case 'GetForwarderlist':
return GetForwarderlist return GetForwarderlist
case 'GetSysUserPage': case 'GetSysUserPage':
return GetSysUserPage return GetSysUserPage
case 'Codeissuetypelist': // case 'Codeissuetypelist':
return Codeissuetypelist // return Codeissuetypelist
case 'GetFrt': // case 'GetFrt':
return GetFrt // return GetFrt
case 'GetService': case 'GetService':
return GetService return GetService
case 'getGoodsname': case 'getGoodsname':
@ -299,6 +304,16 @@ export default {
code: 'TEN' code: 'TEN'
} }
] ]
case 'yard':
return this.yardList
case 'kindpkgs':
return this.packageList
case 'carrierid':
return this.carrierList
case 'issuetype':
return this.issuetypeList
case 'blfrt':
return this.blfrtList
} }
}, },
filterOption(input, option) { filterOption(input, option) {
@ -351,7 +366,7 @@ export default {
this.$refs.selectView.$refs.vcSelect.focus() this.$refs.selectView.$refs.vcSelect.focus()
} }
this.open = true this.open = true
if (['cargoid', 'nobill', 'copynobill'].includes(this.type)) { if (['cargoid', 'nobill', 'copynobill', 'carrierid', 'yard', 'kindpkgs', 'issuetype', 'blfrt'].includes(this.type)) {
this.selectList = this.emnuData(this.type) this.selectList = this.emnuData(this.type)
this.inLoading = false this.inLoading = false
return false return false

@ -328,10 +328,11 @@ export default {
} }
}, },
computed: { computed: {
...mapGetters(['bookingList', 'needSavePages', 'hasbookingDetail', 'bookingList', 'bookingGridOptions']) ...mapGetters(['bookingList', 'needSavePages', 'hasbookingDetail', 'bookingList', 'bookingGridOptions', 'carrierList', 'yardList', 'packageList', 'issuetypeList', 'blfrtList'])
}, },
created() { created() {
this.init() this.init()
console.log('== 进入详情页面,获取公共数据 ==', this.carrierList, this.yardList, this.packageList, this.issuetypeList, this.blfrtList)
}, },
mounted() { mounted() {
window.addEventListener( window.addEventListener(

@ -86,7 +86,8 @@
</div> </div>
</template> </template>
<script> <script>
import { GetCtn, GetPackage, GetYardData } from '@/api/modular/main/BookingLedger' import { GetYardData } from '@/api/modular/main/BookingLedger'
import { mapGetters } from 'vuex'
export default { export default {
name: '', name: '',
props: { props: {
@ -154,7 +155,7 @@ export default {
style="width: 90px" style="width: 90px"
on-change={val => { on-change={val => {
if (val !== undefined) { if (val !== undefined) {
const data = this.ctnList[val] const data = this.ctnallList[val]
this.tableData[rowIndex].ctnall = data.name this.tableData[rowIndex].ctnall = data.name
this.tableData[rowIndex].ctncode = data.code this.tableData[rowIndex].ctncode = data.code
row['ctnall'] = data.name row['ctnall'] = data.name
@ -175,7 +176,7 @@ export default {
console.log('== input - 修改内容==', val) console.log('== input - 修改内容==', val)
}} }}
> >
{this.ctnList.map((item, index) => { {this.ctnallList.map((item, index) => {
return <a-select-option value={index}>{item.name}</a-select-option> return <a-select-option value={index}>{item.name}</a-select-option>
})} })}
</a-select> </a-select>
@ -915,8 +916,8 @@ export default {
} }
}, },
tableLoaded: false, tableLoaded: false,
ctnList: [], // ctnList: [],
packageList: [], // packageList: [],
selectArr: [], selectArr: [],
totalCtnall: '', totalCtnall: '',
totalPkgs: 0, totalPkgs: 0,
@ -954,6 +955,9 @@ export default {
inTableLoad: false inTableLoad: false
} }
}, },
computed: {
...mapGetters(['packageList', 'ctnallList'])
},
watch: { watch: {
details: { details: {
handler(nval, oval) { handler(nval, oval) {
@ -1106,38 +1110,38 @@ export default {
this.totalCbm = 0 this.totalCbm = 0
} }
// console.log('== - ==') // console.log('== - ==')
if (this.ctnList.length === 0) { // if (this.ctnList.length === 0) {
this.getCtn() // this.getCtn()
} // }
if (this.packageList.length === 0) { // if (this.packageList.length === 0) {
this.getPackage() // this.getPackage()
} // }
setTimeout(() => { setTimeout(() => {
this.inTableLoad = false this.inTableLoad = false
}, 1200) }, 1200)
}, },
getCtn() { // getCtn() {
GetCtn({ // GetCtn({
KeyWord: '' // KeyWord: ''
}) // })
.then(res => { // .then(res => {
this.ctnList = res.data // this.ctnList = res.data
}) // })
.catch(err => { // .catch(err => {
console.log(err) // console.log(err)
}) // })
}, // },
getPackage() { // getPackage() {
GetPackage({ // GetPackage({
KeyWord: '' // KeyWord: ''
}) // })
.then(res => { // .then(res => {
this.packageList = res.data // this.packageList = res.data
}) // })
.catch(err => { // .catch(err => {
console.log(err) // console.log(err)
}) // })
}, // },
enmuErrorLabel(val) { enmuErrorLabel(val) {
switch (val) { switch (val) {
case 'cntrno': case 'cntrno':

Loading…
Cancel
Save