feat: fix issues
This commit is contained in:
@@ -16,6 +16,7 @@ import dev.utils.app.info.KeyValue
|
||||
*/
|
||||
class IntImpModifyStorageDialogModel(
|
||||
private val currentLocationId: String = "",
|
||||
private val currentLocationName: String = "",
|
||||
private val callback: (IntImpModifyStorageDialogModel) -> Unit
|
||||
) : BaseDialogModel<DialogIntImpModifyStorageBinding>(DIALOG_TYPE_CENTER) {
|
||||
|
||||
@@ -55,9 +56,14 @@ class IntImpModifyStorageDialogModel(
|
||||
onSuccess = { result ->
|
||||
val list = result.data?.map { it.toKeyValue() } ?: emptyList()
|
||||
locationList.value = list
|
||||
// 列表加载完成后,预选当前库位
|
||||
// 列表加载完成后,预选当前库位(优先按ID匹配,其次按名称匹配)
|
||||
if (currentLocationId.isNotEmpty()) {
|
||||
selectedLocationCode.value = currentLocationId
|
||||
} else if (currentLocationName.isNotEmpty()) {
|
||||
val matched = list.find { it.key == currentLocationName }
|
||||
if (matched != null) {
|
||||
selectedLocationCode.value = matched.value
|
||||
}
|
||||
}
|
||||
}
|
||||
onFailed = { _, msg ->
|
||||
|
||||
Reference in New Issue
Block a user