feat: 开始组装 ui

This commit is contained in:
2025-12-09 16:37:49 +08:00
parent 249b5a4e87
commit 2871cbf784
13 changed files with 200 additions and 72 deletions

View File

@@ -26,6 +26,9 @@ class IntExpAssembleActivity :
setBackArrow("出港组装")
binding.viewModel = viewModel
// 初始化组装人下拉列表
viewModel.initAssemblerList()
// 绑定分页
viewModel.pageModel.bindSmartRefreshLayout(binding.srl, binding.rv, viewModel, this)
@@ -36,5 +39,8 @@ class IntExpAssembleActivity :
FlowBus.with<String>(ConstantEvent.EVENT_REFRESH).observe(this) {
viewModel.refresh()
}
// 首次加载数据
viewModel.refresh()
}
}

View File

@@ -10,6 +10,8 @@ import com.lukouguoji.gjc.databinding.ActivityIntExpAssembleStartBinding
import com.lukouguoji.gjc.viewModel.IntExpAssembleStartViewModel
import com.lukouguoji.module_base.base.BaseBindingActivity
import com.lukouguoji.module_base.base.CommonAdapter
import com.lukouguoji.module_base.interfaces.IOnItemClickListener
import com.lukouguoji.module_base.ktx.addOnItemClickListener
import com.lukouguoji.module_base.router.ARouterConstants
/**
@@ -17,7 +19,8 @@ import com.lukouguoji.module_base.router.ARouterConstants
*/
@Route(path = ARouterConstants.ACTIVITY_URL_INT_EXP_ASSEMBLE_START)
class IntExpAssembleStartActivity :
BaseBindingActivity<ActivityIntExpAssembleStartBinding, IntExpAssembleStartViewModel>() {
BaseBindingActivity<ActivityIntExpAssembleStartBinding, IntExpAssembleStartViewModel>(),
IOnItemClickListener {
private var assembleInfoAdapter: CommonAdapter? = null
private var assemblePositionAdapter: CommonAdapter? = null
@@ -45,6 +48,9 @@ class IntExpAssembleStartActivity :
// 加载模拟数据
viewModel.initMockData()
// 加载组装位置数据从API
viewModel.loadAssemblePosition()
// 观察数据变化
observeData()
}
@@ -70,6 +76,8 @@ class IntExpAssembleStartActivity :
)
binding.rvAssemblePosition.layoutManager = LinearLayoutManager(this)
binding.rvAssemblePosition.adapter = assemblePositionAdapter
// 添加点击监听器
binding.rvAssemblePosition.addOnItemClickListener(this)
// 右侧运单列表
waybillAdapter = CommonAdapter(
@@ -97,4 +105,14 @@ class IntExpAssembleStartActivity :
waybillAdapter?.refresh(list)
}
}
/**
* 列表项点击事件
*/
override fun onItemClick(position: Int, type: Int) {
when (type) {
0 -> viewModel.onPositionItemClick(position) // 组装位置点击
else -> {}
}
}
}