设备预警信息 列表完成,增加分页

master
wenfei 2 weeks ago
parent dd01c167c7
commit a1accf7cb6

@ -20,6 +20,7 @@ import com.rehome.zhdcoa.utils.GsonUtils
import com.rehome.zhdcoa.utils.HttpListener import com.rehome.zhdcoa.utils.HttpListener
import com.rehome.zhdcoa.utils.NohttpUtils import com.rehome.zhdcoa.utils.NohttpUtils
import com.rehome.zhdcoa.utils.RSAAndroid import com.rehome.zhdcoa.utils.RSAAndroid
import com.rehome.zhdcoa.weiget.LoadListView
import com.yolanda.nohttp.NoHttp import com.yolanda.nohttp.NoHttp
import com.yolanda.nohttp.RequestMethod import com.yolanda.nohttp.RequestMethod
import com.yolanda.nohttp.rest.Response import com.yolanda.nohttp.rest.Response
@ -96,20 +97,21 @@ class DeviceAlarmInfoActivity : BaseActivityOaToolbarViewBinding<ActivityDeviceA
binding.lv.onItemClickListener = AdapterView.OnItemClickListener { _, _, position, _ -> binding.lv.onItemClickListener = AdapterView.OnItemClickListener { _, _, position, _ ->
val item:DeviceAlarmListResultBean.DeviceWarning = datas[position] val item:DeviceAlarmListResultBean.DeviceWarning = datas[position]
showLog(GsonUtils.GsonString(item)) showLog(GsonUtils.GsonString(item))
//点击进入应急预案执行状态
// val intent = Intent(context, YjyaActionActivity::class.java)
// intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP)
// intent.putExtra("YAID",item.id)
// startActivity(intent)
} }
binding.btnQuery.setOnClickListener { binding.btnQuery.setOnClickListener {
authenticationLoginDeviceAlermInfo() authenticationLoginDeviceAlermInfo()
} }
// binding.lv.setOnItemClickListener { _, _, position, _ -> binding.lv.setInterface(LoadListView.ILoadListener {
// val item: WarehouseHuoJiaBean.RowsBean = warehouseHuoJiaList[position] getAlermListLoadMoreData()
// val intent = Intent() })
// intent.setClass(this, WztpblScDetailActivity::class.java)
// intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP)
// intent.putExtra("item",Gson().toJson(item))
// startActivity(intent)
// }
} }
@ -239,6 +241,7 @@ class DeviceAlarmInfoActivity : BaseActivityOaToolbarViewBinding<ActivityDeviceA
deviceAlarmInfoAdapter.notifyDataSetChanged() deviceAlarmInfoAdapter.notifyDataSetChanged()
binding.tvNodata.visibility = View.GONE binding.tvNodata.visibility = View.GONE
headView.visibility = View.VISIBLE headView.visibility = View.VISIBLE
pageNo++
}else{ }else{
datas.clear() datas.clear()
deviceAlarmInfoAdapter.notifyDataSetChanged() deviceAlarmInfoAdapter.notifyDataSetChanged()
@ -253,6 +256,60 @@ class DeviceAlarmInfoActivity : BaseActivityOaToolbarViewBinding<ActivityDeviceA
}) })
} }
private fun getAlermListLoadMoreData() {
val request = NoHttp.createStringRequest(
Contans.IP + Contans.DeviceAlermInfoListUrl,
RequestMethod.GET
)
request.add("pageNo",pageNo)
request.add("pageSize",pageSize)
val zyTemp:String = binding.spZy.selectedItem.toString()
val zyIndex:Int = binding.spZy.selectedItemPosition
if(zyIndex!=0){
request.add("specialty",specialtyList[zyIndex])
}
showLog(zyTemp)
showLog(zyIndex.toString())
val keyword = binding.etKey.text.toString().trim()
if(!TextUtils.isEmpty(keyword)){
request.add("keyword",keyword)
}
NohttpUtils.getInstance().add(this, 0, request, object : HttpListener<String?> {
override fun onSucceed(what: Int, response: Response<String?>?) {
val result = response?.get()
showLog("----------------")
showLog(result)
val bean = GsonUtils.GsonToBean(
result,
DeviceAlarmListResultBean::class.java
)
showLog(GsonUtils.GsonString(bean))
if (bean != null && bean.code == 20000 && bean.isSuccess && bean.data != null && bean.data.dataList != null && bean.data.dataList.size>0) {
datas.addAll(bean.data.dataList)
deviceAlarmInfoAdapter.notifyDataSetChanged()
binding.tvNodata.visibility = View.GONE
headView.visibility = View.VISIBLE
pageNo++
binding.lv.loadComplete()
}else{
showToast("没有更多数据啦")
}
}
override fun onFailed(what: Int, response: Response<String?>?) {
showToast("加载数据失败")
binding.lv.loadComplete()
}
})
}
private fun toWorkRiskListHuiBaoActivity(type:String){ private fun toWorkRiskListHuiBaoActivity(type:String){
//工作情况汇报 //工作情况汇报
val intent = Intent(context, WorkRiskListHuiBaoActivity::class.java) val intent = Intent(context, WorkRiskListHuiBaoActivity::class.java)

@ -1013,7 +1013,7 @@ public class ApplyListUtils {
@Override @Override
public void onFailed(int what, com.yolanda.nohttp.rest.Response<String> response) { public void onFailed(int what, com.yolanda.nohttp.rest.Response<String> response) {
showToast("加载数据失败");
} }
}); });

@ -83,7 +83,7 @@
android:layout_marginBottom="5dp" android:layout_marginBottom="5dp"
android:layout_weight="1"> android:layout_weight="1">
<ListView <com.rehome.zhdcoa.weiget.LoadListView
android:id="@+id/lv" android:id="@+id/lv"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"

Loading…
Cancel
Save