package com.future.dispatch.ui.order.change_order
|
|
import android.view.View
|
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.RecyclerView
|
import com.example.oktrip.netUtls.callNet
|
import com.example.oktrip.netUtls.createView
|
import com.future.dispatch.R
|
import com.future.dispatch.base.BaseEvent
|
import com.future.dispatch.base.BaseRecyclerActivity
|
import com.future.dispatch.base.BaseRvAdapter
|
import com.future.dispatch.bean.DriverListBean
|
import com.future.dispatch.netUtls.Api
|
import com.future.dispatch.ui.adapter.ChangeNewAdapter
|
import com.future.dispatch.utils.clickDelay
|
import com.future.dispatch.utils.getMapByAny
|
import kotlinx.android.synthetic.main.view_btn_sure.view.*
|
import org.greenrobot.eventbus.EventBus
|
import org.jetbrains.anko.startActivity
|
import org.jetbrains.anko.toast
|
import java.util.HashMap
|
|
/**
|
* @ClassName ChangeNowActivity
|
* @Description 改派 选择司机 更换线路
|
* @Author Administrator
|
* @Date 2020/10/9 15:14
|
* @Version 1.0
|
*/
|
class ChangeNowActivity:BaseRecyclerActivity<DriverListBean.DataBean>() {
|
|
val reassignId by lazy {
|
intent.getStringExtra("reassignId")
|
}
|
|
val changeNewAdapter by lazy {
|
ChangeNewAdapter()
|
}
|
|
override fun getDatas(t: String?): List<DriverListBean.DataBean> {
|
return gson.fromJson<DriverListBean>(t,DriverListBean::class.java).data
|
}
|
|
override fun pathUrl(): String? {
|
return Api.queryReassignDriver
|
}
|
|
override fun mapObject(): HashMap<String?, Any?>? {
|
var map = getMapByAny()
|
map["reassignId"] = reassignId
|
return map
|
}
|
|
override fun getAdapter(): BaseRvAdapter<DriverListBean.DataBean>? {
|
return changeNewAdapter
|
}
|
|
override fun getlayoutManager(): RecyclerView.LayoutManager? {
|
return LinearLayoutManager(this)
|
}
|
|
override fun setOnItemClickListener(view: View?, position: Int) {
|
}
|
|
override fun initView() {
|
setTitleText("改派")
|
var view = createView(R.layout.view_btn_sure,this)
|
addMainBottomViewSimple(view)
|
view.tv_sure_view.clickDelay {
|
callChange()
|
}
|
}
|
|
private fun callChange() {
|
if (changeNewAdapter.selectPosition == -1){
|
toast("请选择司机")
|
return
|
}
|
var map = getMapByAny()
|
map["driverId"] = changeNewAdapter.data[changeNewAdapter.selectPosition].id
|
map["id"] = reassignId
|
callNet(Api.executeReassign,map){
|
toast("改派成功")
|
startActivity<RightAwayActivity>("id" to reassignId,"type" to "2")
|
EventBus.getDefault().post(BaseEvent(BaseEvent.FILTER_CHANGE_ORDER))
|
finish()
|
}
|
|
}
|
|
override fun setOnclick() {
|
|
}
|
}
|