修改面板快捷新增时的种类联动

This commit is contained in:
squallzhjch 2023-05-06 15:38:27 +08:00
parent fbff312f41
commit 3733634eb5
8 changed files with 52 additions and 38 deletions

View File

@ -19,4 +19,6 @@ data class SignBean(
val geometry: String, val geometry: String,
//底部文字 //底部文字
val bottomText: String, val bottomText: String,
//要素code类型
val elementCode: Int
) : Parcelable ) : Parcelable

View File

@ -75,7 +75,7 @@ class RealmOperateHelper() {
GeometryTools.createPoint( GeometryTools.createPoint(
point.longitude, point.longitude,
point.latitude point.latitude
), it ) , it
) )
) )
} else { } else {

View File

@ -33,6 +33,9 @@ interface ScProblemTypeDao {
@Query("select DISTINCT CLASS_TYPE from ScProblemType order by CLASS_TYPE") @Query("select DISTINCT CLASS_TYPE from ScProblemType order by CLASS_TYPE")
suspend fun findClassTypeList(): List<String>? suspend fun findClassTypeList(): List<String>?
@Query("select DISTINCT CLASS_TYPE from ScProblemType where ELEMENT_CODE=:code")
suspend fun findClassTypeByCode(code: Int): String?
/** /**
* 获取问题类型并去重 * 获取问题类型并去重
*/ */

View File

@ -215,7 +215,8 @@ class MainViewModel @Inject constructor(
elementId = element.id, elementId = element.id,
linkId = linkId, linkId = linkId,
geometry = element.geometry, geometry = element.geometry,
bottomText = SignUtil.getSignBottomText(element) bottomText = SignUtil.getSignBottomText(element),
elementCode = element.code
) )
) )
} }

View File

@ -117,11 +117,9 @@ class EvaluationResultViewModel @Inject constructor(
* 查询数据库获取问题分类 * 查询数据库获取问题分类
*/ */
fun initNewData(bean: SignBean?, filePath: String) { fun initNewData(bean: SignBean?, filePath: String) {
viewModelScope.launch(Dispatchers.IO) { //获取当前定位点
getClassTypeList()
getProblemLinkList()
}
val geoPoint = mapController.locationLayerHandler.getCurrentGeoPoint() val geoPoint = mapController.locationLayerHandler.getCurrentGeoPoint()
//如果不是从面板进来的
if (bean == null) { if (bean == null) {
geoPoint?.let { geoPoint?.let {
liveDataQsRecordBean.value!!.geometry = GeometryTools.createGeometry(it).toText() liveDataQsRecordBean.value!!.geometry = GeometryTools.createGeometry(it).toText()
@ -147,13 +145,17 @@ class EvaluationResultViewModel @Inject constructor(
} }
} }
} }
}
val point = GeometryTools.createGeoPoint(bean.geometry) val point = GeometryTools.createGeoPoint(bean.geometry)
liveDataQsRecordBean.value!!.geometry = GeometryTools.createGeometry(point).toText() this.geometry = GeometryTools.createGeometry(point).toText()
mapController.animationHandler.animationByLonLat(point.latitude, point.longitude) mapController.animationHandler.animationByLonLat(point.latitude, point.longitude)
mapController.markerHandle.addMarker(point, markerTitle) mapController.markerHandle.addMarker(point, markerTitle)
} }
}
//查询元数据
viewModelScope.launch(Dispatchers.IO) {
getClassTypeList(bean)
getProblemLinkList()
}
addChatMsgEntity(filePath) addChatMsgEntity(filePath)
} }
@ -182,18 +184,23 @@ class EvaluationResultViewModel @Inject constructor(
/** /**
* //获取问题分类列表 * //获取问题分类列表
*/ */
fun getClassTypeList() { fun getClassTypeList(bean: SignBean? = null) {
Log.e("jingo", "getClassTypeList S")
viewModelScope.launch(Dispatchers.IO) { viewModelScope.launch(Dispatchers.IO) {
val list = roomAppDatabase.getScProblemTypeDao().findClassTypeList() val list = roomAppDatabase.getScProblemTypeDao().findClassTypeList()
list?.let { list?.let {
if (list.isNotEmpty()) { if (list.isNotEmpty()) {
//通知页面更新 //通知页面更新
liveDataLeftTypeList.postValue(it) 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()) { if (liveDataQsRecordBean.value!!.classType.isEmpty()) {
Log.e("jingo", "getClassTypeList $classType")
liveDataQsRecordBean.value!!.classType = classType liveDataQsRecordBean.value!!.classType = classType
classTypeTemp = classType classTypeTemp = classType
} }
@ -201,7 +208,6 @@ class EvaluationResultViewModel @Inject constructor(
} }
} }
} }
Log.e("jingo", "getClassTypeList E")
} }
/** /**

View File

@ -1,5 +1,6 @@
package com.navinfo.omqs.ui.fragment.evaluationresult package com.navinfo.omqs.ui.fragment.evaluationresult
import android.os.Build
import android.os.Bundle import android.os.Bundle
import android.util.Log import android.util.Log
import android.view.LayoutInflater import android.view.LayoutInflater
@ -62,11 +63,13 @@ class PhenomenonFragment :
} }
binding.phenomenonRightRecyclerview.adapter = rightAdapter binding.phenomenonRightRecyclerview.adapter = rightAdapter
//右侧菜单增加组标题 //右侧菜单增加组标题
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
binding.phenomenonRightRecyclerview.addItemDecoration( binding.phenomenonRightRecyclerview.addItemDecoration(
RightGroupHeaderDecoration( RightGroupHeaderDecoration(
requireContext() requireContext()
) )
) )
}
//右侧菜单查询数据监听 //右侧菜单查询数据监听
viewModel.liveDataRightTypeList.observe(viewLifecycleOwner) { viewModel.liveDataRightTypeList.observe(viewLifecycleOwner) {
rightAdapter.refreshData(it) rightAdapter.refreshData(it)

View File

@ -6,16 +6,16 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/ivory" android:background="@color/ivory"
android:paddingLeft="10dp" android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="5dp" android:paddingTop="5dp"
android:paddingRight="10dp"
tools:context="com.navinfo.omqs.ui.fragment.offlinemap.OfflineMapCityListAdapter"> tools:context="com.navinfo.omqs.ui.fragment.offlinemap.OfflineMapCityListAdapter">
<TextView <TextView
android:id="@+id/offline_map_city_name" android:id="@+id/offline_map_city_name"
style="@style/map_size_font_style"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="省市名称" android:text="省市名称"
style="@style/map_size_font_style"
android:textSize="@dimen/default_font_size" /> android:textSize="@dimen/default_font_size" />
<TextView <TextView
@ -24,19 +24,19 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@id/offline_map_city_name" android:layout_below="@id/offline_map_city_name"
android:drawableLeft="@mipmap/point_blue"
android:layout_marginTop="5dp" android:layout_marginTop="5dp"
android:textColor="@color/gray_121" android:drawableLeft="@mipmap/point_blue"
android:text="文件大小" /> android:text="文件大小"
android:textColor="@color/gray_121" />
<TextView <TextView
android:id="@+id/offline_map_download_btn" android:id="@+id/offline_map_download_btn"
style="@style/map_download_style_btn" style="@style/map_download_style_btn"
android:layout_width="60dp" android:layout_width="60dp"
android:layout_alignTop="@id/offline_map_city_name"
android:layout_alignBottom="@id/offline_map_city_size"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_gravity="center_vertical"
android:gravity="center"
android:shadowColor="@android:color/transparent" android:shadowColor="@android:color/transparent"
android:text="下载" android:text="下载"
android:textColor="@color/btn_blue_solid" android:textColor="@color/btn_blue_solid"
@ -44,6 +44,7 @@
<TextView <TextView
android:id="@+id/tv_city_list_status" android:id="@+id/tv_city_list_status"
style="@style/content_font_default_size_13sp"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_centerVertical="true"
@ -51,8 +52,7 @@
android:layout_toLeftOf="@id/offline_map_download_btn" android:layout_toLeftOf="@id/offline_map_download_btn"
android:clickable="true" android:clickable="true"
android:focusable="false" android:focusable="false"
android:shadowColor="@android:color/transparent" android:shadowColor="@android:color/transparent" />
style="@style/content_font_default_size_13sp" />
<com.navinfo.omqs.ui.widget.MyProgressBar <com.navinfo.omqs.ui.widget.MyProgressBar
android:id="@+id/offline_map_progress" android:id="@+id/offline_map_progress"
@ -60,7 +60,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="16dp" android:layout_height="16dp"
android:layout_below="@id/offline_map_download_btn" android:layout_below="@id/offline_map_download_btn"
android:progressDrawable="@drawable/progress_bg"
android:paddingTop="10dp" android:paddingTop="10dp"
android:progressDrawable="@drawable/progress_bg"
android:visibility="invisible" /> android:visibility="invisible" />
</RelativeLayout> </RelativeLayout>

View File

@ -15,10 +15,9 @@
android:id="@+id/task_name" android:id="@+id/task_name"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_toLeftOf="@id/task_download_btn" android:layout_marginRight="5dp"
android:text="任务名称" android:text="任务名称"
android:textColor="@color/white" android:textSize="12sp" />
android:textSize="@dimen/default_font_size" />
<TextView <TextView
android:id="@+id/task_city_name" android:id="@+id/task_city_name"
@ -35,9 +34,10 @@
style="@style/map_size_font_style" style="@style/map_size_font_style"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_toRightOf="@id/task_city_name" android:layout_marginRight="5dp"
android:layout_alignTop="@id/task_city_name" android:layout_below="@id/task_city_name"
android:layout_marginLeft="5dp" android:layout_toLeftOf="@id/task_upload_btn"
android:layout_alignParentLeft="true"
android:text="版本号" android:text="版本号"
android:textSize="@dimen/card_title_font_3size" /> android:textSize="@dimen/card_title_font_3size" />
@ -46,9 +46,8 @@
style="@style/map_size_font_style" style="@style/map_size_font_style"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@id/task_city_name" android:layout_below="@id/task_data_version"
android:layout_marginTop="5dp" android:layout_marginTop="5dp"
android:drawableLeft="@mipmap/point_blue"
android:text="路线颜色" android:text="路线颜色"
android:textSize="@dimen/card_title_font_3size" /> android:textSize="@dimen/card_title_font_3size" />