|
|
@ -24,7 +24,7 @@ |
|
|
label-position="top" |
|
|
label-position="top" |
|
|
:model="searchData" |
|
|
:model="searchData" |
|
|
class="search-form" |
|
|
class="search-form" |
|
|
@keyup.enter.native="getMainData"> |
|
|
|
|
|
|
|
|
@keyup.enter.native="handleSearch"> |
|
|
|
|
|
|
|
|
<!-- 所有查询条件 - 可展开/收起 --> |
|
|
<!-- 所有查询条件 - 可展开/收起 --> |
|
|
<template v-if="searchExpanded"> |
|
|
<template v-if="searchExpanded"> |
|
|
@ -119,7 +119,7 @@ |
|
|
<el-button |
|
|
<el-button |
|
|
type="primary" |
|
|
type="primary" |
|
|
icon="el-icon-search" |
|
|
icon="el-icon-search" |
|
|
@click="getMainData"> |
|
|
|
|
|
|
|
|
@click="handleSearch"> |
|
|
查询 |
|
|
查询 |
|
|
</el-button> |
|
|
</el-button> |
|
|
<el-button |
|
|
<el-button |
|
|
@ -1088,17 +1088,41 @@ export default { |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
}, |
|
|
}, |
|
|
|
|
|
handleSearch() { |
|
|
|
|
|
// 新查询条件统一从第一页开始,避免页码越界导致拿到异常页数据 |
|
|
|
|
|
this.pageIndex = 1; |
|
|
|
|
|
this.getMainData(); |
|
|
|
|
|
}, |
|
|
getMainData(){ |
|
|
getMainData(){ |
|
|
|
|
|
this.dataListLoading = true |
|
|
|
|
|
const requestedPage = this.pageIndex |
|
|
this.searchData.limit = this.pageSize |
|
|
this.searchData.limit = this.pageSize |
|
|
this.searchData.page = this.pageIndex |
|
|
|
|
|
|
|
|
this.searchData.page = requestedPage |
|
|
getKuCunLabelData(this.searchData).then(({data}) => { |
|
|
getKuCunLabelData(this.searchData).then(({data}) => { |
|
|
if (data.code === 0) { |
|
|
|
|
|
this.dataList = data.page.list |
|
|
|
|
|
this.pageIndex = data.page.currPage |
|
|
|
|
|
this.pageSize = data.page.pageSize |
|
|
|
|
|
this.totalPage = data.page.totalCount |
|
|
|
|
|
this.totalQty = data.page.list.length > 0 ? data.page.list[0].totalQty : 0 |
|
|
|
|
|
|
|
|
if (data.code === 0 && data.page) { |
|
|
|
|
|
const serverPageSize = Number(data.page.pageSize) || this.pageSize |
|
|
|
|
|
const totalCount = Number(data.page.totalCount) || 0 |
|
|
|
|
|
const maxPage = totalCount > 0 ? Math.ceil(totalCount / serverPageSize) : 1 |
|
|
|
|
|
|
|
|
|
|
|
// 防止页码越界时返回非目标页,自动回退到最后一页再查询一次 |
|
|
|
|
|
if (requestedPage > maxPage && maxPage > 0) { |
|
|
|
|
|
this.pageIndex = maxPage |
|
|
|
|
|
this.getMainData() |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.dataList = data.page.list || [] |
|
|
|
|
|
this.pageIndex = Number(data.page.currPage) || requestedPage |
|
|
|
|
|
this.pageSize = serverPageSize |
|
|
|
|
|
this.totalPage = totalCount |
|
|
|
|
|
this.totalQty = this.dataList.length > 0 ? this.dataList[0].totalQty : 0 |
|
|
|
|
|
this.selectionDataList = [] |
|
|
|
|
|
} else { |
|
|
|
|
|
this.dataList = [] |
|
|
|
|
|
this.totalPage = 0 |
|
|
|
|
|
this.totalQty = 0 |
|
|
} |
|
|
} |
|
|
|
|
|
}).finally(() => { |
|
|
this.dataListLoading = false |
|
|
this.dataListLoading = false |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
|