| | |
| | | package cn.flightfeather.thirdappmodule.module.inspection |
| | | |
| | | import android.arch.lifecycle.Observer |
| | | import android.arch.lifecycle.ViewModelProviders |
| | | import android.databinding.DataBindingUtil |
| | | import android.os.Bundle |
| | | import android.view.View |
| | | import android.widget.TextView |
| | | import cn.flightfeather.thirdappmodule.R |
| | | import cn.flightfeather.thirdappmodule.bean.entity.Scense |
| | | import cn.flightfeather.thirdappmodule.databinding.DialogSceneHistory2Binding |
| | | import cn.flightfeather.thirdappmodule.databinding.SceneHistoryViewModel |
| | | import cn.flightfeather.thirdappmodule.module.base.BaseActivity |
| | | import kotlinx.android.synthetic.main.dialog_scene_history.* |
| | | |
| | | /** |
| | | * 场景历史情况提示界面 |
| | |
| | | // 传入的场景对象 |
| | | private var scene: Scense? = null |
| | | |
| | | // override fun getLayoutId(): Int = R.layout.dialog_scene_history_2 |
| | | override fun getLayoutId(): Int? = null |
| | | override fun getLayoutId(): Int = R.layout.dialog_scene_history |
| | | |
| | | lateinit var viewModel: SceneHistoryViewModel |
| | | |
| | |
| | | |
| | | scene = intent.getSerializableExtra("scene") as Scense? |
| | | |
| | | // 2025.10.31 场景风险提示 |
| | | val dialogSceneHistory2Binding = DataBindingUtil.setContentView<DialogSceneHistory2Binding>(this, R.layout.dialog_scene_history_2) |
| | | dialogSceneHistory2Binding.viewModel = viewModel |
| | | dialogSceneHistory2Binding.fabClose.setOnClickListener { this.finish() } |
| | | initUI() |
| | | initObserver() |
| | | initListener() |
| | | |
| | | scene?.let { |
| | | viewModel.fetchChangeInfoList(it.guid) |
| | | viewModel.fetchProblemRecurrence(it.guid) |
| | | viewModel.fetchInspectionKeyPoint(it.guid) |
| | | } |
| | | } |
| | | |
| | | // viewModel.getSceneStatus { |
| | | // scene?.let { viewModel.getSceneDetail(it) } |
| | | // } |
| | | private fun initUI() { |
| | | // 默认先将三块内容隐藏 |
| | | cl_risk_warn.visibility = View.GONE |
| | | cl_inspection_key_point.visibility = View.GONE |
| | | cl_temp_inspection.visibility = View.GONE |
| | | tv_change_rate.visibility = View.GONE |
| | | tv_change_efficiency.visibility = View.GONE |
| | | tv_problem_recurrence.visibility = View.GONE |
| | | } |
| | | |
| | | private fun initObserver() { |
| | | // 风险提示 |
| | | viewModel.changeInfoTxt.observe(this, Observer { |
| | | it?.let { |
| | | tv_change_rate.text = it |
| | | tv_change_rate.visibility = View.VISIBLE |
| | | cl_risk_warn.visibility = View.VISIBLE |
| | | } |
| | | }) |
| | | viewModel.changeEfficiencyTxt.observe(this, Observer { |
| | | it?.let { |
| | | tv_change_efficiency.text = it |
| | | tv_change_efficiency.visibility = View.VISIBLE |
| | | cl_risk_warn.visibility = View.VISIBLE |
| | | } |
| | | }) |
| | | viewModel.problemRecurrenceTxt.observe(this, Observer { |
| | | it?.let { |
| | | tv_problem_recurrence.text = it |
| | | tv_problem_recurrence.visibility = View.VISIBLE |
| | | cl_risk_warn.visibility = View.VISIBLE |
| | | } |
| | | }) |
| | | // 巡查要点 |
| | | viewModel.inspectionKeyPointTxt.observe(this, Observer { |
| | | it?.let { |
| | | tv_key_point.text = it |
| | | cl_inspection_key_point.visibility = View.VISIBLE |
| | | } |
| | | }) |
| | | // 应急巡查 |
| | | viewModel.tempInspectionTxt.observe(this, Observer { |
| | | it?.let { |
| | | tv_temp_inspection.text = it |
| | | cl_temp_inspection.visibility = View.VISIBLE |
| | | } |
| | | }) |
| | | } |
| | | |
| | | private fun initListener() { |
| | | fab_close.setOnClickListener { |
| | | this.finish() |
| | | } |
| | | } |
| | | } |