|
|
|
@ -2,9 +2,11 @@ package com.project.survey.ui.pointmeasure.adapter |
|
|
|
|
|
|
|
|
|
import android.content.Context |
|
|
|
|
import android.view.ViewGroup |
|
|
|
|
import android.widget.TextView |
|
|
|
|
import com.chad.library.adapter4.BaseQuickAdapter |
|
|
|
|
import com.chad.library.adapter4.viewholder.QuickViewHolder |
|
|
|
|
import com.project.survey.R |
|
|
|
|
import com.project.survey.constants.AdapterConstants |
|
|
|
|
import com.project.survey.constants.Constants |
|
|
|
|
import com.project.survey.model.MeasureBean |
|
|
|
|
|
|
|
|
@ -18,10 +20,30 @@ class PointMeasureListAdapter(val type: String) : BaseQuickAdapter<MeasureBean, |
|
|
|
|
holder.setText(R.id.tvName, if (isCLJH) item.CLJH_LCMC else item.GCJL_LCMC) |
|
|
|
|
.setText(R.id.tvNO, if (isCLJH) item.CLJH_BDLSH else item.GCJL_BDLSH) |
|
|
|
|
.setText(R.id.tvType, item.CLJH_CLLX_NAME) |
|
|
|
|
.setGone(R.id.tvType, !isCLJH) |
|
|
|
|
.setText(R.id.tvProjectName, item.BD_FBFXPZ_FXGCMC) |
|
|
|
|
.setText(R.id.tvMeasureContent, item.CLJH_CONTENT) |
|
|
|
|
.setText(R.id.tvApplyUser, "") |
|
|
|
|
.setText( |
|
|
|
|
R.id.tvMeasureContentKey, |
|
|
|
|
if (isCLJH) "测 量 内 容 :" else "计 量 内 容 :" |
|
|
|
|
) |
|
|
|
|
.setText(R.id.tvMeasureContent, if (isCLJH) item.CLJH_CONTENT else item.GCJL_JLNR) |
|
|
|
|
.setText(R.id.tvApplyUser, item.SY_CREATEUSERNAME) |
|
|
|
|
.setVisible(R.id.tvGenerateForm, isCLJH) |
|
|
|
|
|
|
|
|
|
.setEnabled( |
|
|
|
|
R.id.tvGenerateForm, |
|
|
|
|
"已结束" == item.CLJH_WORKSTATUS || "报验单已生成" == item.CLJH_WORKSTATUS |
|
|
|
|
) |
|
|
|
|
if (isCLJH) { |
|
|
|
|
holder.setEnabled(R.id.tvStopMeasure, "执行中" == item.CLJH_WORKSTATUS) |
|
|
|
|
.setEnabled( |
|
|
|
|
R.id.tvEnterMeasure, |
|
|
|
|
"执行中" == item.CLJH_WORKSTATUS || "待执行" == item.CLJH_WORKSTATUS || item.CLJH_WORKSTATUS.isNullOrBlank() |
|
|
|
|
) |
|
|
|
|
} else { |
|
|
|
|
holder.setEnabled(R.id.tvStopMeasure, true) |
|
|
|
|
.setEnabled(R.id.tvEnterMeasure, true) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
override fun onCreateViewHolder( |
|
|
|
@ -31,4 +53,34 @@ class PointMeasureListAdapter(val type: String) : BaseQuickAdapter<MeasureBean, |
|
|
|
|
): QuickViewHolder { |
|
|
|
|
return QuickViewHolder(R.layout.item_point_measure_list, parent) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
override fun onBindViewHolder( |
|
|
|
|
holder: QuickViewHolder, |
|
|
|
|
position: Int, |
|
|
|
|
item: MeasureBean?, |
|
|
|
|
payloads: List<Any> |
|
|
|
|
) { |
|
|
|
|
super.onBindViewHolder(holder, position, item, payloads) |
|
|
|
|
if (payloads.isNotEmpty() && payloads[0] is Int && item != null) { |
|
|
|
|
// true测量计划,false工程计量 |
|
|
|
|
val isCLJH = type == Constants.TYPE_BD_CLJH |
|
|
|
|
val type = payloads[0] as Int |
|
|
|
|
if (type == AdapterConstants.WORK_STATUS) { |
|
|
|
|
holder.setEnabled( |
|
|
|
|
R.id.tvGenerateForm, |
|
|
|
|
"已结束" == item.CLJH_WORKSTATUS || "报验单已生成" == item.CLJH_WORKSTATUS |
|
|
|
|
) |
|
|
|
|
if (isCLJH) { |
|
|
|
|
holder.setEnabled(R.id.tvStopMeasure, "执行中" == item.CLJH_WORKSTATUS) |
|
|
|
|
.setEnabled( |
|
|
|
|
R.id.tvEnterMeasure, |
|
|
|
|
"执行中" == item.CLJH_WORKSTATUS || "待执行" == item.CLJH_WORKSTATUS || item.CLJH_WORKSTATUS.isNullOrBlank() |
|
|
|
|
) |
|
|
|
|
} else { |
|
|
|
|
holder.setEnabled(R.id.tvStopMeasure, true) |
|
|
|
|
.setEnabled(R.id.tvEnterMeasure, true) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |