添加了界面及逻辑
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
package com.sw.platecabinet.viewmodel
|
||||
|
||||
import com.sw.platecabinet.model.request.EquipmentParam
|
||||
import com.sw.platecabinet.model.response.EquipmentUserInfo
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
|
||||
class SettingViewModel : BaseViewModel() {
|
||||
// 设备绑定列表
|
||||
private val _equipmentList = MutableStateFlow<List<EquipmentUserInfo>>(emptyList())
|
||||
val equipmentList: StateFlow<List<EquipmentUserInfo>> = _equipmentList
|
||||
|
||||
fun getEquipmentList(param: EquipmentParam) {
|
||||
launchWithLoading {
|
||||
val response = repository.getEquipmentList(param)
|
||||
if (parseResponse(response)) {
|
||||
_equipmentList.value = response.data ?: emptyList()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user