修改面板快捷新增时的种类联动
This commit is contained in:
@@ -19,4 +19,6 @@ data class SignBean(
|
||||
val geometry: String,
|
||||
//底部文字
|
||||
val bottomText: String,
|
||||
//要素code类型
|
||||
val elementCode: Int
|
||||
) : Parcelable
|
||||
@@ -75,7 +75,7 @@ class RealmOperateHelper() {
|
||||
GeometryTools.createPoint(
|
||||
point.longitude,
|
||||
point.latitude
|
||||
), it
|
||||
) , it
|
||||
)
|
||||
)
|
||||
} else {
|
||||
|
||||
@@ -33,6 +33,9 @@ interface ScProblemTypeDao {
|
||||
@Query("select DISTINCT CLASS_TYPE from ScProblemType order by CLASS_TYPE")
|
||||
suspend fun findClassTypeList(): List<String>?
|
||||
|
||||
@Query("select DISTINCT CLASS_TYPE from ScProblemType where ELEMENT_CODE=:code")
|
||||
suspend fun findClassTypeByCode(code: Int): String?
|
||||
|
||||
/**
|
||||
* 获取问题类型,并去重
|
||||
*/
|
||||
|
||||
@@ -215,7 +215,8 @@ class MainViewModel @Inject constructor(
|
||||
elementId = element.id,
|
||||
linkId = linkId,
|
||||
geometry = element.geometry,
|
||||
bottomText = SignUtil.getSignBottomText(element)
|
||||
bottomText = SignUtil.getSignBottomText(element),
|
||||
elementCode = element.code
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -117,11 +117,9 @@ class EvaluationResultViewModel @Inject constructor(
|
||||
* 查询数据库,获取问题分类
|
||||
*/
|
||||
fun initNewData(bean: SignBean?, filePath: String) {
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
getClassTypeList()
|
||||
getProblemLinkList()
|
||||
}
|
||||
//获取当前定位点
|
||||
val geoPoint = mapController.locationLayerHandler.getCurrentGeoPoint()
|
||||
//如果不是从面板进来的
|
||||
if (bean == null) {
|
||||
geoPoint?.let {
|
||||
liveDataQsRecordBean.value!!.geometry = GeometryTools.createGeometry(it).toText()
|
||||
@@ -147,13 +145,17 @@ class EvaluationResultViewModel @Inject constructor(
|
||||
}
|
||||
}
|
||||
}
|
||||
val point = GeometryTools.createGeoPoint(bean.geometry)
|
||||
this.geometry = GeometryTools.createGeometry(point).toText()
|
||||
mapController.animationHandler.animationByLonLat(point.latitude, point.longitude)
|
||||
mapController.markerHandle.addMarker(point, markerTitle)
|
||||
}
|
||||
val point = GeometryTools.createGeoPoint(bean.geometry)
|
||||
liveDataQsRecordBean.value!!.geometry = GeometryTools.createGeometry(point).toText()
|
||||
mapController.animationHandler.animationByLonLat(point.latitude, point.longitude)
|
||||
mapController.markerHandle.addMarker(point, markerTitle)
|
||||
}
|
||||
|
||||
//查询元数据
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
getClassTypeList(bean)
|
||||
getProblemLinkList()
|
||||
}
|
||||
addChatMsgEntity(filePath)
|
||||
}
|
||||
|
||||
@@ -182,18 +184,23 @@ class EvaluationResultViewModel @Inject constructor(
|
||||
/**
|
||||
* //获取问题分类列表
|
||||
*/
|
||||
fun getClassTypeList() {
|
||||
Log.e("jingo", "getClassTypeList S")
|
||||
fun getClassTypeList(bean: SignBean? = null) {
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
val list = roomAppDatabase.getScProblemTypeDao().findClassTypeList()
|
||||
list?.let {
|
||||
if (list.isNotEmpty()) {
|
||||
//通知页面更新
|
||||
liveDataLeftTypeList.postValue(it)
|
||||
val classType = it[0]
|
||||
var classType = it[0]
|
||||
if (bean != null) {
|
||||
val classType2 = roomAppDatabase.getScProblemTypeDao()
|
||||
.findClassTypeByCode(bean.elementCode)
|
||||
if (classType2 != null)
|
||||
classType = classType2
|
||||
}
|
||||
//如果右侧栏没数据,给个默认值
|
||||
if (liveDataQsRecordBean.value!!.classType.isEmpty()) {
|
||||
Log.e("jingo", "getClassTypeList $classType")
|
||||
|
||||
liveDataQsRecordBean.value!!.classType = classType
|
||||
classTypeTemp = classType
|
||||
}
|
||||
@@ -201,7 +208,6 @@ class EvaluationResultViewModel @Inject constructor(
|
||||
}
|
||||
}
|
||||
}
|
||||
Log.e("jingo", "getClassTypeList E")
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.navinfo.omqs.ui.fragment.evaluationresult
|
||||
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
@@ -62,11 +63,13 @@ class PhenomenonFragment :
|
||||
}
|
||||
binding.phenomenonRightRecyclerview.adapter = rightAdapter
|
||||
//右侧菜单增加组标题
|
||||
binding.phenomenonRightRecyclerview.addItemDecoration(
|
||||
RightGroupHeaderDecoration(
|
||||
requireContext()
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
binding.phenomenonRightRecyclerview.addItemDecoration(
|
||||
RightGroupHeaderDecoration(
|
||||
requireContext()
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
//右侧菜单查询数据监听
|
||||
viewModel.liveDataRightTypeList.observe(viewLifecycleOwner) {
|
||||
rightAdapter.refreshData(it)
|
||||
|
||||
Reference in New Issue
Block a user