添加采购单位添加后同步

This commit is contained in:
zxj
2025-08-14 15:16:41 +08:00
parent 7ffda3b24b
commit 77ac6d02e6
2 changed files with 16 additions and 2 deletions
@@ -119,8 +119,8 @@ class RemoteRepository @Inject constructor(
suspend fun searchGoodsInfoList(
goodsName: String,
pageNo: Int,
pageSize: Int
pageNo: Int = 1,
pageSize: Int = 10
): ApiResponse<SearchGoodsInfo> {
return safeApiCall {
apiService.searchGoodsInfoList(goodsName, pageNo, pageSize)
@@ -360,6 +360,20 @@ class SelfProcurementViewModel @Inject constructor(
_goodsAddUnitParam.value = GoodsPurchaseUnitParam()
// _addGoodsPurchaseUnitResult.value = true
ToastUtils.showToast("采购单位添加成功")
// 通过id搜索物品,补充采购单位
val response = repository.searchGoodsInfoList(
goodsName = "${_selectedItem.value?.goodsId}"
)
if (parseResponse(response)) {
val searchList: List<SearchGoodsInfo.Record> =
response.result?.records ?: emptyList()
if (searchList.isNotEmpty()) {
_selectedItem.value = _selectedItem.value?.copy(
unitList = searchList[0].unitVoList
)
}
}
}
}
}