|
@@ -7,7 +7,7 @@ import com.grkj.iscs.databinding.FragmentWorkerBinding
|
|
|
import com.grkj.iscs.model.Constants.USER_ROLE_COLOCKER
|
|
import com.grkj.iscs.model.Constants.USER_ROLE_COLOCKER
|
|
|
import com.grkj.iscs.model.Constants.USER_ROLE_LOCKER
|
|
import com.grkj.iscs.model.Constants.USER_ROLE_LOCKER
|
|
|
import com.grkj.iscs.model.bo.PageChangeBO
|
|
import com.grkj.iscs.model.bo.PageChangeBO
|
|
|
-import com.grkj.iscs.model.vo.ticket.TicketDetailRespVO
|
|
|
|
|
|
|
+import com.grkj.iscs.model.vo.ticket.TicketUserReqVO
|
|
|
import com.grkj.iscs.model.vo.user.UserListRespVO
|
|
import com.grkj.iscs.model.vo.user.UserListRespVO
|
|
|
import com.grkj.iscs.view.base.BaseMvpFragment
|
|
import com.grkj.iscs.view.base.BaseMvpFragment
|
|
|
import com.grkj.iscs.view.iview.IWorkerView
|
|
import com.grkj.iscs.view.iview.IWorkerView
|
|
@@ -20,8 +20,9 @@ import com.zhy.adapter.recyclerview.base.ViewHolder
|
|
|
*/
|
|
*/
|
|
|
class WorkerFragment(val goBack: () -> Unit, val changePage: (PageChangeBO) -> Unit) :
|
|
class WorkerFragment(val goBack: () -> Unit, val changePage: (PageChangeBO) -> Unit) :
|
|
|
BaseMvpFragment<IWorkerView, WorkerPresenter, FragmentWorkerBinding>() {
|
|
BaseMvpFragment<IWorkerView, WorkerPresenter, FragmentWorkerBinding>() {
|
|
|
|
|
+ private val mSelectedList = mutableListOf<TicketUserReqVO>()
|
|
|
|
|
+ private val mColockerSelectedShowList = mutableListOf<TicketUserReqVO>() // 仅展示用
|
|
|
|
|
|
|
|
- private val mColockerSelectedList = mutableListOf<TicketDetailRespVO.UserVO>()
|
|
|
|
|
private val mLockerList = mutableListOf<UserListRespVO.Row>()
|
|
private val mLockerList = mutableListOf<UserListRespVO.Row>()
|
|
|
private val mColockerInsideList = mutableListOf<UserListRespVO.Row>()
|
|
private val mColockerInsideList = mutableListOf<UserListRespVO.Row>()
|
|
|
private val mColockerOutsideList = mutableListOf<UserListRespVO.Row>()
|
|
private val mColockerOutsideList = mutableListOf<UserListRespVO.Row>()
|
|
@@ -36,11 +37,20 @@ class WorkerFragment(val goBack: () -> Unit, val changePage: (PageChangeBO) -> U
|
|
|
goBack()
|
|
goBack()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- mBinding?.rvWorkerSelected?.adapter =
|
|
|
|
|
- object : CommonAdapter<TicketDetailRespVO.UserVO>(requireActivity(), R.layout.item_rv_worker, mColockerSelectedList) {
|
|
|
|
|
- override fun convert(holder: ViewHolder, data: TicketDetailRespVO.UserVO, position: Int) {
|
|
|
|
|
|
|
+ mBinding?.rvColockerSelected?.adapter =
|
|
|
|
|
+ object : CommonAdapter<TicketUserReqVO>(requireActivity(), R.layout.item_rv_worker, mColockerSelectedShowList) {
|
|
|
|
|
+ override fun convert(holder: ViewHolder, data: TicketUserReqVO, position: Int) {
|
|
|
holder.getView<ImageView>(R.id.iv_photo).isSelected = true
|
|
holder.getView<ImageView>(R.id.iv_photo).isSelected = true
|
|
|
holder.setText(R.id.tv_name, data.userName)
|
|
holder.setText(R.id.tv_name, data.userName)
|
|
|
|
|
+ holder.setOnClickListener(R.id.root) {
|
|
|
|
|
+ // 共锁人取消
|
|
|
|
|
+ mSelectedList.removeIf { it.userId == data.userId }
|
|
|
|
|
+ mColockerSelectedShowList.removeIf { it.userId == data.userId }
|
|
|
|
|
+ mBinding?.rvColockerSelected?.adapter?.notifyDataSetChanged()
|
|
|
|
|
+ mBinding?.rvColockerInside?.adapter?.notifyDataSetChanged()
|
|
|
|
|
+ mBinding?.rvColockerOutside?.adapter?.notifyDataSetChanged()
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -59,23 +69,73 @@ class WorkerFragment(val goBack: () -> Unit, val changePage: (PageChangeBO) -> U
|
|
|
mBinding?.rvLockerList?.adapter =
|
|
mBinding?.rvLockerList?.adapter =
|
|
|
object : CommonAdapter<UserListRespVO.Row>(requireActivity(), R.layout.item_rv_worker, mLockerList) {
|
|
object : CommonAdapter<UserListRespVO.Row>(requireActivity(), R.layout.item_rv_worker, mLockerList) {
|
|
|
override fun convert(holder: ViewHolder, user: UserListRespVO.Row, position: Int) {
|
|
override fun convert(holder: ViewHolder, user: UserListRespVO.Row, position: Int) {
|
|
|
|
|
+ holder.getView<ImageView>(R.id.iv_photo).isSelected = mSelectedList.any { it.userId == user.userId }
|
|
|
holder.setText(R.id.tv_name, user.nickName)
|
|
holder.setText(R.id.tv_name, user.nickName)
|
|
|
|
|
+ holder.setOnClickListener(R.id.root) {
|
|
|
|
|
+ // 上锁人选择
|
|
|
|
|
+ if (mSelectedList.any { it.userId == user.userId }) {
|
|
|
|
|
+ mSelectedList.removeIf { it.userId == user.userId }
|
|
|
|
|
+ mBinding?.layoutLocker?.root?.visibility = View.INVISIBLE
|
|
|
|
|
+ } else {
|
|
|
|
|
+ mSelectedList.removeIf { it.userRole == USER_ROLE_LOCKER }
|
|
|
|
|
+ mSelectedList.add(TicketUserReqVO(user.userId!!, user.nickName!!, "0", USER_ROLE_LOCKER))
|
|
|
|
|
+ mBinding?.layoutLocker?.root?.visibility = View.VISIBLE
|
|
|
|
|
+ mBinding?.layoutLocker?.tvName?.text = user.nickName
|
|
|
|
|
+ }
|
|
|
|
|
+ mBinding?.rvLockerList?.adapter?.notifyDataSetChanged()
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- mBinding?.rvLockerInside?.adapter =
|
|
|
|
|
|
|
+ mBinding?.rvColockerInside?.adapter =
|
|
|
object : CommonAdapter<UserListRespVO.Row>(requireActivity(), R.layout.item_rv_worker, mColockerInsideList) {
|
|
object : CommonAdapter<UserListRespVO.Row>(requireActivity(), R.layout.item_rv_worker, mColockerInsideList) {
|
|
|
override fun convert(holder: ViewHolder, user: UserListRespVO.Row, position: Int) {
|
|
override fun convert(holder: ViewHolder, user: UserListRespVO.Row, position: Int) {
|
|
|
|
|
+ holder.getView<ImageView>(R.id.iv_photo).isSelected = mSelectedList.any { it.userId == user.userId }
|
|
|
holder.setText(R.id.tv_name, user.nickName)
|
|
holder.setText(R.id.tv_name, user.nickName)
|
|
|
|
|
+ holder.setOnClickListener(R.id.root) {
|
|
|
|
|
+ // 内部共锁人选择
|
|
|
|
|
+ if (mSelectedList.any { it.userId == user.userId }) {
|
|
|
|
|
+ mSelectedList.removeIf { it.userId == user.userId }
|
|
|
|
|
+ mColockerSelectedShowList.removeIf { it.userId == user.userId }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ val addUser = TicketUserReqVO(user.userId!!, user.nickName!!, "0", USER_ROLE_COLOCKER)
|
|
|
|
|
+ mSelectedList.add(addUser)
|
|
|
|
|
+ mColockerSelectedShowList.add(addUser)
|
|
|
|
|
+ }
|
|
|
|
|
+ mBinding?.rvColockerSelected?.adapter?.notifyDataSetChanged()
|
|
|
|
|
+ mBinding?.rvColockerInside?.adapter?.notifyDataSetChanged()
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- mBinding?.rvLockerOutside?.adapter =
|
|
|
|
|
|
|
+ mBinding?.rvColockerOutside?.adapter =
|
|
|
object : CommonAdapter<UserListRespVO.Row>(requireActivity(), R.layout.item_rv_worker, mColockerOutsideList) {
|
|
object : CommonAdapter<UserListRespVO.Row>(requireActivity(), R.layout.item_rv_worker, mColockerOutsideList) {
|
|
|
override fun convert(holder: ViewHolder, user: UserListRespVO.Row, position: Int) {
|
|
override fun convert(holder: ViewHolder, user: UserListRespVO.Row, position: Int) {
|
|
|
|
|
+ holder.getView<ImageView>(R.id.iv_photo).isSelected = mSelectedList.any { it.userId == user.userId }
|
|
|
holder.setText(R.id.tv_name, user.nickName)
|
|
holder.setText(R.id.tv_name, user.nickName)
|
|
|
|
|
+ holder.setOnClickListener(R.id.root) {
|
|
|
|
|
+ // 外部共锁人选择
|
|
|
|
|
+ if (mSelectedList.any { it.userId == user.userId }) {
|
|
|
|
|
+ mSelectedList.removeIf { it.userId == user.userId }
|
|
|
|
|
+ mColockerSelectedShowList.removeIf { it.userId == user.userId }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ val addUser = TicketUserReqVO(user.userId!!, user.nickName!!, "1", USER_ROLE_COLOCKER)
|
|
|
|
|
+ mSelectedList.add(addUser)
|
|
|
|
|
+ mColockerSelectedShowList.add(addUser)
|
|
|
|
|
+ }
|
|
|
|
|
+ mBinding?.rvColockerSelected?.adapter?.notifyDataSetChanged()
|
|
|
|
|
+ mBinding?.rvColockerOutside?.adapter?.notifyDataSetChanged()
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ mBinding?.layoutLocker?.root?.setOnClickListener {
|
|
|
|
|
+ if (mBinding?.layoutLocker?.root?.visibility == View.VISIBLE) {
|
|
|
|
|
+ mBinding?.layoutLocker?.root?.visibility = View.INVISIBLE
|
|
|
|
|
+ mSelectedList.removeIf { it.userRole == USER_ROLE_LOCKER }
|
|
|
|
|
+ mBinding?.rvLockerList?.adapter?.notifyDataSetChanged()
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
override fun refreshPage(pageChangeBO: PageChangeBO) {
|
|
override fun refreshPage(pageChangeBO: PageChangeBO) {
|
|
@@ -88,20 +148,23 @@ class WorkerFragment(val goBack: () -> Unit, val changePage: (PageChangeBO) -> U
|
|
|
if (it?.jobTicketUserList.isNullOrEmpty()) {
|
|
if (it?.jobTicketUserList.isNullOrEmpty()) {
|
|
|
return@getTicketDetail
|
|
return@getTicketDetail
|
|
|
}
|
|
}
|
|
|
- mColockerSelectedList.clear()
|
|
|
|
|
|
|
+ mSelectedList.clear()
|
|
|
|
|
+ mColockerSelectedShowList.clear()
|
|
|
it?.jobTicketUserList?.forEach { user ->
|
|
it?.jobTicketUserList?.forEach { user ->
|
|
|
if (user.userRole == USER_ROLE_LOCKER) {
|
|
if (user.userRole == USER_ROLE_LOCKER) {
|
|
|
mBinding?.layoutLocker?.root?.visibility = View.VISIBLE
|
|
mBinding?.layoutLocker?.root?.visibility = View.VISIBLE
|
|
|
mBinding?.layoutLocker?.tvName?.text = user.userName
|
|
mBinding?.layoutLocker?.tvName?.text = user.userName
|
|
|
- } else if (user.userRole == USER_ROLE_COLOCKER) {
|
|
|
|
|
- mColockerSelectedList.add(user)
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+ mSelectedList.add(TicketUserReqVO(user.userId!!, user.userName!!, user.userType!!, user.userRole!!))
|
|
|
}
|
|
}
|
|
|
- mBinding?.rvWorkerSelected?.adapter?.notifyDataSetChanged()
|
|
|
|
|
|
|
+ mColockerSelectedShowList.addAll(mSelectedList.filter { it.userRole == USER_ROLE_COLOCKER }.toMutableList())
|
|
|
|
|
+ mBinding?.rvColockerSelected?.adapter?.notifyDataSetChanged()
|
|
|
|
|
+ mBinding?.rvLockerList?.adapter?.notifyDataSetChanged()
|
|
|
|
|
+ mBinding?.rvColockerInside?.adapter?.notifyDataSetChanged()
|
|
|
|
|
+ mBinding?.rvColockerOutside?.adapter?.notifyDataSetChanged()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
presenter?.getUserList(mPageChangeBO?.workstationId, 3, 9) {
|
|
presenter?.getUserList(mPageChangeBO?.workstationId, 3, 9) {
|
|
|
- println("上锁人 : $it")
|
|
|
|
|
mLockerList.clear()
|
|
mLockerList.clear()
|
|
|
if (!it?.rows.isNullOrEmpty()) {
|
|
if (!it?.rows.isNullOrEmpty()) {
|
|
|
mLockerList.addAll(it?.rows!!)
|
|
mLockerList.addAll(it?.rows!!)
|
|
@@ -110,7 +173,6 @@ class WorkerFragment(val goBack: () -> Unit, val changePage: (PageChangeBO) -> U
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
presenter?.getUserList(mPageChangeBO?.workstationId, 4) {
|
|
presenter?.getUserList(mPageChangeBO?.workstationId, 4) {
|
|
|
- println("共锁人 : $it")
|
|
|
|
|
mColockerInsideList.clear()
|
|
mColockerInsideList.clear()
|
|
|
mColockerOutsideList.clear()
|
|
mColockerOutsideList.clear()
|
|
|
if (!it?.rows.isNullOrEmpty()) {
|
|
if (!it?.rows.isNullOrEmpty()) {
|
|
@@ -122,8 +184,8 @@ class WorkerFragment(val goBack: () -> Unit, val changePage: (PageChangeBO) -> U
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- mBinding?.rvLockerInside?.adapter?.notifyDataSetChanged()
|
|
|
|
|
- mBinding?.rvLockerOutside?.adapter?.notifyDataSetChanged()
|
|
|
|
|
|
|
+ mBinding?.rvColockerInside?.adapter?.notifyDataSetChanged()
|
|
|
|
|
+ mBinding?.rvColockerOutside?.adapter?.notifyDataSetChanged()
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|