From e234a15b428267997c903a4ed42536c5d9f14a1f Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期一, 10 十一月 2025 13:10:42 +0800
Subject: [PATCH] 2025.11.10 1. 新增巡查场景历史详情相关数据逻辑; 2. 新增工地施工阶段修改界面;

---
 app/src/main/java/cn/flightfeather/thirdappmodule/module/task/SceneDetailViewModel.kt |   66 +++++++++++++++++++++++++++++++++
 1 files changed, 66 insertions(+), 0 deletions(-)

diff --git a/app/src/main/java/cn/flightfeather/thirdappmodule/module/task/SceneDetailViewModel.kt b/app/src/main/java/cn/flightfeather/thirdappmodule/module/task/SceneDetailViewModel.kt
index b4fe933..bd89fb5 100644
--- a/app/src/main/java/cn/flightfeather/thirdappmodule/module/task/SceneDetailViewModel.kt
+++ b/app/src/main/java/cn/flightfeather/thirdappmodule/module/task/SceneDetailViewModel.kt
@@ -2,10 +2,16 @@
 
 import android.arch.lifecycle.MutableLiveData
 import cn.flightfeather.thirdappmodule.bean.entity.*
+import cn.flightfeather.thirdappmodule.bean.vo.BaseSubScene
+import cn.flightfeather.thirdappmodule.bean.vo.SceneConstructionSite
+import cn.flightfeather.thirdappmodule.bean.vo.SceneDetailStrVo
+import cn.flightfeather.thirdappmodule.bean.vo.SceneDetailVo
 import cn.flightfeather.thirdappmodule.common.net.ResultCallBack
 import cn.flightfeather.thirdappmodule.model.event.SceneEvent
 import cn.flightfeather.thirdappmodule.module.base.BaseViewModel
+import cn.flightfeather.thirdappmodule.repository.CommonRepository
 import cn.flightfeather.thirdappmodule.repository.SceneRepository
+import com.google.gson.Gson
 import okhttp3.ResponseBody
 import org.greenrobot.eventbus.EventBus
 import org.jetbrains.anko.toast
@@ -16,6 +22,7 @@
  */
 class SceneDetailViewModel : BaseViewModel() {
     private val sceneRepository = SceneRepository()
+    private val commonRepository = CommonRepository.instance
 
     val allProvinceList = ArrayList<Province>()
     val allCityList = ArrayList<City>()
@@ -29,6 +36,12 @@
 
     val allSceneTypeList = MutableLiveData<ArrayList<Domainitem>>().apply { value = ArrayList() }
 
+    val subScene = MutableLiveData<BaseSubScene>()
+    val sceneStatus = ArrayList<String>()
+
+    /**
+     * 鑾峰彇琛屾斂鍖哄垝鍙�夐」
+     */
     fun getData() {
         sceneRepository.getDivision(object : ResultCallBack<Division> {
             override fun onSuccess(result: Division?) {
@@ -55,6 +68,9 @@
         })
     }
 
+    /**
+     * 鑾峰彇鍦烘櫙绫诲瀷鍙�夐」
+     */
     fun getSceneType() {
         sceneRepository.getSceneType(object : ResultCallBack<ArrayList<Domainitem>> {
             override fun onSuccess(result: ArrayList<Domainitem>?) {
@@ -107,6 +123,56 @@
             })
         }
     }
+
+    fun getSceneDetail(scene: Scense?) {
+        scene?.let {
+            sceneRepository.getSceneDetail(it, object : ResultCallBack<SceneDetailVo<SceneConstructionSite>> {
+                override fun onSuccess(result: SceneDetailVo<SceneConstructionSite>?) {
+                    result?.let { r ->
+                        subScene.value = r.subScene
+                    }
+                }
+
+                override fun onFailure() {
+                    application.toast("鏂藉伐闃舵娌℃湁璁板綍")
+                }
+            })
+        }
+    }
+
+    fun updateSceneDetail(scene: Scense?, success: () -> Unit) {
+        scene?.let {
+            val vo = SceneDetailStrVo().apply {
+                this.scene = it
+                this.subScene = Gson().toJson(this@SceneDetailViewModel.subScene.value)
+            }
+            sceneRepository.updateSceneDetail(vo, object : ResultCallBack<String> {
+                override fun onSuccess(result: String?) {
+                    application.toast("鏂藉伐闃舵淇敼鎴愬姛")
+                    success()
+                }
+
+                override fun onFailure() {
+                    application.toast("鏂藉伐闃舵淇敼澶辫触")
+                }
+            })
+        }
+    }
+
+    fun getSceneStatus(success: () -> Unit) {
+        commonRepository.getDomainItem("宸ュ湴宸ユ湡", object : ResultCallBack<ArrayList<Domainitem>> {
+            override fun onSuccess(result: ArrayList<Domainitem>?) {
+                result?.let { arr ->
+                    sceneStatus.addAll(arr.map { it.text })
+                    success()
+                }
+            }
+
+            override fun onFailure() {
+                application.toast("鏂藉伐闃舵閫夐」鏃犺褰�")
+            }
+        })
+    }
 }
 
 data class Division(

--
Gitblit v1.9.3