feat: fix issues

This commit is contained in:
2026-03-26 20:00:41 +08:00
parent bfc39b5d96
commit 67b2dc6d71
3 changed files with 23 additions and 2 deletions

View File

@@ -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 ->