|
|
|
@ -22,8 +22,7 @@ import com.scwang.smart.refresh.layout.listener.OnRefreshLoadMoreListener |
|
|
|
|
/** |
|
|
|
|
* 点测量列表 |
|
|
|
|
*/ |
|
|
|
|
class PointMeasureListActivity : BaseBindingActivity<ActivityPointMeasureListBinding>(), |
|
|
|
|
OnRefreshLoadMoreListener { |
|
|
|
|
class PointMeasureListActivity : BaseBindingActivity<ActivityPointMeasureListBinding>() { |
|
|
|
|
|
|
|
|
|
companion object { |
|
|
|
|
const val KEY_TYPE = "KEY_TYPE" |
|
|
|
@ -39,7 +38,7 @@ class PointMeasureListActivity : BaseBindingActivity<ActivityPointMeasureListBin |
|
|
|
|
|
|
|
|
|
private val adapter by lazy { PointMeasureListAdapter(type) } |
|
|
|
|
private var type = "" |
|
|
|
|
private var currentPage = 1 |
|
|
|
|
// private var currentPage = 1 |
|
|
|
|
|
|
|
|
|
// private var start = 0 |
|
|
|
|
private var searchContent = "" // 搜索框里的内容 |
|
|
|
@ -56,7 +55,9 @@ class PointMeasureListActivity : BaseBindingActivity<ActivityPointMeasureListBin |
|
|
|
|
else -> "" |
|
|
|
|
} |
|
|
|
|
) |
|
|
|
|
mBinding.smartRefreshLayout.setOnRefreshLoadMoreListener(this) |
|
|
|
|
mBinding.smartRefreshLayout.setEnableLoadMore(false) |
|
|
|
|
mBinding.smartRefreshLayout.setEnableRefresh(false) |
|
|
|
|
// mBinding.smartRefreshLayout.setOnRefreshLoadMoreListener(this) |
|
|
|
|
mBinding.recyclerView.setAdapter(adapter) |
|
|
|
|
adapter.isStateViewEnable = true |
|
|
|
|
} |
|
|
|
@ -71,24 +72,23 @@ class PointMeasureListActivity : BaseBindingActivity<ActivityPointMeasureListBin |
|
|
|
|
viewModel.measureBeanListResponse.observe(this) { |
|
|
|
|
dismissLoadingDialog() |
|
|
|
|
mBinding.smartRefreshLayout.smartDismiss() |
|
|
|
|
if (currentPage == 1) { |
|
|
|
|
// if (currentPage == 1) { |
|
|
|
|
adapter.submitList(it.rows) |
|
|
|
|
if (it.rows.isEmpty()) { |
|
|
|
|
mBinding.smartRefreshLayout.finishLoadMoreWithNoMoreData() |
|
|
|
|
adapter.setStateViewLayout(this, R.layout.layout_no_data) |
|
|
|
|
} else { |
|
|
|
|
currentPage++ |
|
|
|
|
// start += it.totalCount |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
if (it.rows.isEmpty()) { |
|
|
|
|
mBinding.smartRefreshLayout.finishLoadMoreWithNoMoreData() |
|
|
|
|
} else { |
|
|
|
|
adapter.addAll(it.rows) |
|
|
|
|
currentPage++ |
|
|
|
|
// start += it.totalCount |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// else { |
|
|
|
|
// currentPage++ |
|
|
|
|
// } |
|
|
|
|
// } else { |
|
|
|
|
// if (it.rows.isEmpty()) { |
|
|
|
|
// mBinding.smartRefreshLayout.finishLoadMoreWithNoMoreData() |
|
|
|
|
// } else { |
|
|
|
|
// adapter.addAll(it.rows) |
|
|
|
|
// currentPage++ |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
} |
|
|
|
|
// 生成报验单 |
|
|
|
|
viewModel.createInspectionReportResponse.observe(this) { |
|
|
|
@ -113,7 +113,7 @@ class PointMeasureListActivity : BaseBindingActivity<ActivityPointMeasureListBin |
|
|
|
|
// 搜索 |
|
|
|
|
mBinding.searchWidget.setOnEditorSearchListener { |
|
|
|
|
searchContent = it |
|
|
|
|
currentPage = 1 |
|
|
|
|
// currentPage = 1 |
|
|
|
|
showLoadingDialog() |
|
|
|
|
fetchData() |
|
|
|
|
} |
|
|
|
@ -154,17 +154,17 @@ class PointMeasureListActivity : BaseBindingActivity<ActivityPointMeasureListBin |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private fun fetchData() { |
|
|
|
|
viewModel.fetchMeasureDataList(type, currentPage, searchContent) |
|
|
|
|
viewModel.fetchMeasureDataList(type, 1, searchContent) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
override fun onRefresh(refreshLayout: RefreshLayout) { |
|
|
|
|
currentPage = 1 |
|
|
|
|
fetchData() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
override fun onLoadMore(refreshLayout: RefreshLayout) { |
|
|
|
|
fetchData() |
|
|
|
|
} |
|
|
|
|
// override fun onRefresh(refreshLayout: RefreshLayout) { |
|
|
|
|
// currentPage = 1 |
|
|
|
|
// fetchData() |
|
|
|
|
// } |
|
|
|
|
// |
|
|
|
|
// override fun onLoadMore(refreshLayout: RefreshLayout) { |
|
|
|
|
// fetchData() |
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |