|
|
@@ -3,6 +3,7 @@ package com.grkj.iscs.view.fragment
|
|
|
import android.widget.ImageView
|
|
|
import com.grkj.iscs.R
|
|
|
import com.grkj.iscs.databinding.FragmentStepBinding
|
|
|
+import com.grkj.iscs.model.vo.ticket.StepDetailRespVO
|
|
|
import com.grkj.iscs.view.base.BaseMvpFragment
|
|
|
import com.grkj.iscs.view.iview.IStepView
|
|
|
import com.grkj.iscs.view.presenter.StepPresenter
|
|
|
@@ -21,14 +22,14 @@ class StepFragment(val goBack: () -> Unit, val changePage: (Int) -> Unit) : Base
|
|
|
|
|
|
override fun initView() {
|
|
|
mStepList = mutableListOf(
|
|
|
- StepBO(R.mipmap.step1, getString(R.string.recognize_work_content), false, 1, "①"),
|
|
|
- StepBO(R.mipmap.step2, getString(R.string.power_isolation_way), false, 2, "②"),
|
|
|
- StepBO(R.mipmap.step3, getString(R.string.notice_worker), false, 3, "③"),
|
|
|
- StepBO(R.mipmap.step4, getString(R.string.shutdown), false, 4, "④"),
|
|
|
- StepBO(R.mipmap.step5, getString(R.string.unlock_and_restore_switch), false, 8, "⑧"),
|
|
|
- StepBO(R.mipmap.step6, getString(R.string.check_before_unlocking), false, 7, "⑦"),
|
|
|
- StepBO(R.mipmap.step7, getString(R.string.ensure_power_isolation), false, 6, "⑥"),
|
|
|
- StepBO(R.mipmap.step8, getString(R.string.lock_and_hang_a_sign), false, 5, "⑤")
|
|
|
+ StepBO(R.mipmap.step1, getString(R.string.recognize_work_content), 1, "①"),
|
|
|
+ StepBO(R.mipmap.step2, getString(R.string.power_isolation_way), 2, "②"),
|
|
|
+ StepBO(R.mipmap.step3, getString(R.string.notice_worker), 3, "③"),
|
|
|
+ StepBO(R.mipmap.step4, getString(R.string.shutdown), 4, "④"),
|
|
|
+ StepBO(R.mipmap.step5, getString(R.string.unlock_and_restore_switch), 8, "⑧"),
|
|
|
+ StepBO(R.mipmap.step6, getString(R.string.check_before_unlocking), 7, "⑦"),
|
|
|
+ StepBO(R.mipmap.step7, getString(R.string.ensure_power_isolation), 6, "⑥"),
|
|
|
+ StepBO(R.mipmap.step8, getString(R.string.lock_and_hang_a_sign), 5, "⑤")
|
|
|
)
|
|
|
mBinding?.rvStep?.adapter = object : CommonAdapter<StepBO>(requireContext(), R.layout.item_rv_step, mStepList) {
|
|
|
override fun convert(holder: ViewHolder, step: StepBO, position: Int) {
|
|
|
@@ -41,10 +42,10 @@ class StepFragment(val goBack: () -> Unit, val changePage: (Int) -> Unit) : Base
|
|
|
holder.getView<ImageView>(R.id.iv_arrow_right).rotation = 180f
|
|
|
}
|
|
|
holder.getView<ImageView>(R.id.iv_icon).setImageResource(step.pic)
|
|
|
- holder.setText(R.id.tv_name, step.title)
|
|
|
+ holder.setText(R.id.tv_name, step.stepDetail?.stepContent)
|
|
|
holder.setText(R.id.tv_index, step.indexStr)
|
|
|
- holder.getView<ImageView>(R.id.iv_status).setImageResource(if (step.isDone) R.mipmap.step_executed else R.mipmap.step_not_executed)
|
|
|
- holder.setText(R.id.tv_status, if (step.isDone) getString(R.string.executed) else getString(R.string.not_executed))
|
|
|
+ holder.getView<ImageView>(R.id.iv_status).setImageResource(if (step.stepDetail?.stepStatus == "1") R.mipmap.step_executed else R.mipmap.step_not_executed)
|
|
|
+ holder.setText(R.id.tv_status, if (step.stepDetail?.stepStatus == "1") getString(R.string.executed) else getString(R.string.not_executed))
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -61,13 +62,18 @@ class StepFragment(val goBack: () -> Unit, val changePage: (Int) -> Unit) : Base
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- fun refreshPage() {
|
|
|
-
|
|
|
+ fun refreshPage(ticketId: Long) {
|
|
|
+ presenter?.getStepDetail(ticketId) {
|
|
|
+ mStepList.forEach { step ->
|
|
|
+ step.stepDetail = it?.find { it.stepIndex == step.index }
|
|
|
+ }
|
|
|
+ mBinding?.rvStep?.adapter?.notifyDataSetChanged()
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
override fun initPresenter(): StepPresenter {
|
|
|
return StepPresenter()
|
|
|
}
|
|
|
|
|
|
- data class StepBO(val pic: Int, val title: String, val isDone: Boolean = false, val index: Int, val indexStr: String)
|
|
|
+ data class StepBO(val pic: Int, val title: String, val index: Int, val indexStr: String, var stepDetail: StepDetailRespVO? = null)
|
|
|
}
|