修复货位列表:Bearer前缀+响应格式兼容
This commit is contained in:
parent
83e2d0103b
commit
ce5b63fcc1
@ -1149,18 +1149,24 @@ export default {
|
|||||||
warehouse_id: warehouseId, type: 1, status: 1,
|
warehouse_id: warehouseId, type: 1, status: 1,
|
||||||
page: 1, page_size: 999
|
page: 1, page_size: 999
|
||||||
})
|
})
|
||||||
if (res.code === 0 && res.data && res.data.list) {
|
console.log('【货位列表】load响应:', JSON.stringify(res))
|
||||||
this.popupLocationList = res.data.list
|
// 兼容多种响应格式
|
||||||
this.popupAllLocationList = res.data.list
|
let list = []
|
||||||
const total = res.data.total || 0
|
if (res.code === 0 && res.data) {
|
||||||
this.popupLocHasMore = this.popupLocPage * this.popupLocPageSize < total
|
list = res.data.list || res.data.records || []
|
||||||
} else {
|
}
|
||||||
const list = Array.isArray(res.data) ? res.data : []
|
if (list.length === 0) {
|
||||||
|
list = res.list || res.records || []
|
||||||
|
}
|
||||||
|
if (list.length > 0) {
|
||||||
this.popupLocationList = list
|
this.popupLocationList = list
|
||||||
this.popupAllLocationList = list
|
this.popupAllLocationList = list
|
||||||
this.popupLocHasMore = false
|
this.popupLocHasMore = false
|
||||||
|
} else {
|
||||||
|
console.warn('货位列表为空', JSON.stringify(res))
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
console.error('加载货位失败:', e)
|
||||||
this.popupLocationList = this.popupAllLocationList
|
this.popupLocationList = this.popupAllLocationList
|
||||||
this.popupLocHasMore = false
|
this.popupLocHasMore = false
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
@ -190,7 +190,7 @@ export function getLocationList(params = {}) {
|
|||||||
url: url,
|
url: url,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
header: {
|
header: {
|
||||||
'Authorization': locToken
|
'Authorization': 'Bearer ' + locToken
|
||||||
},
|
},
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
console.log('【货位列表】响应状态码:', res.statusCode)
|
console.log('【货位列表】响应状态码:', res.statusCode)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user