| | |
| | | package cn.flightfeather.thirdapp.module.inspection |
| | | |
| | | import android.arch.lifecycle.MutableLiveData |
| | | import cn.flightfeather.thirdapp.bean.Inspection |
| | | import cn.flightfeather.thirdapp.bean.Scense |
| | | import cn.flightfeather.thirdapp.bean.Subtask |
| | | import cn.flightfeather.thirdapp.bean.entity.Inspection |
| | | import cn.flightfeather.thirdapp.bean.entity.Scense |
| | | import cn.flightfeather.thirdapp.bean.entity.Subtask |
| | | import cn.flightfeather.thirdapp.bean.vo.InspectionVo |
| | | import cn.flightfeather.thirdapp.bean.vo.ProblemlistVo |
| | | import cn.flightfeather.thirdapp.common.net.ResultCallBack |
| | |
| | | } |
| | | } |
| | | |
| | | updateSubTask() |
| | | updateInspection(inspection.value) |
| | | |
| | | //更新界面 |
| | | subTask.value = subTask.value |
| | | updateSubTask { |
| | | //更新界面 |
| | | subTask.value = subTask.value |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 更新子任务 |
| | | */ |
| | | fun updateSubTask() { |
| | | fun updateSubTask(s: () -> Unit) { |
| | | subTask.value?.let { |
| | | inspectionRepository.updateSubTask(it, object : ResultCallBack<String> { |
| | | override fun onSuccess(result: String?) { |
| | | |
| | | result?.let { |
| | | updateInspection(inspection.value){ |
| | | s() |
| | | } |
| | | } |
| | | } |
| | | |
| | | override fun onFailure() { |
| | |
| | | /** |
| | | * 更新巡查信息 |
| | | */ |
| | | fun updateInspection(inspection: Inspection?) { |
| | | fun updateInspection(inspection: Inspection?, s: () -> Unit = {}) { |
| | | inspection?.let { |
| | | inspectionRepository.updateInspection(it, object : ResultCallBack<ResponseBody> { |
| | | override fun onSuccess(result: ResponseBody?) { |
| | | |
| | | result?.let {r -> |
| | | val n = r.string().toIntOrNull() |
| | | if (n == 1) { |
| | | s() |
| | | } else { |
| | | application.toast("提交巡查信息失败,请检查网络") |
| | | } |
| | | } |
| | | } |
| | | |
| | | override fun onFailure() { |