feat: 国际出港 出港组装
This commit is contained in:
@@ -588,10 +588,10 @@ interface Api {
|
|||||||
/**
|
/**
|
||||||
* 国际出港组装-删除记录
|
* 国际出港组装-删除记录
|
||||||
* 接口路径: /IntExpAssemble/delete
|
* 接口路径: /IntExpAssemble/delete
|
||||||
* @param ids ULD使用记录ID,多个用逗号分隔
|
* @param data GjcUldUseBean数组
|
||||||
*/
|
*/
|
||||||
@POST("IntExpAssemble/delete")
|
@POST("IntExpAssemble/delete")
|
||||||
suspend fun deleteIntExpAssemble(@Query("ids") ids: String): BaseResultBean<SimpleResultBean>
|
suspend fun deleteIntExpAssemble(@Body data: RequestBody): BaseResultBean<Boolean>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 国际出港组装-回填重量
|
* 国际出港组装-回填重量
|
||||||
|
|||||||
@@ -36,6 +36,19 @@ class IntExpAssembleItemViewHolder(view: View) :
|
|||||||
clickListener?.onItemClick(position, 1000) // type=1000表示展开操作
|
clickListener?.onItemClick(position, 1000) // type=1000表示展开操作
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ========== 侧滑菜单按钮点击事件 ==========
|
||||||
|
// 修改按钮
|
||||||
|
binding.btnEdit.setOnClickListener {
|
||||||
|
binding.swipeMenu.quickClose()
|
||||||
|
clickListener?.onItemClick(position, 2000) // type=2000表示修改操作
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除按钮
|
||||||
|
binding.btnDelete.setOnClickListener {
|
||||||
|
binding.swipeMenu.quickClose()
|
||||||
|
clickListener?.onItemClick(position, 2001) // type=2001表示删除操作
|
||||||
|
}
|
||||||
|
|
||||||
// ========== 初始化子列表 RecyclerView ==========
|
// ========== 初始化子列表 RecyclerView ==========
|
||||||
setCommonAdapter(
|
setCommonAdapter(
|
||||||
binding.rvSub,
|
binding.rvSub,
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import com.lukouguoji.module_base.http.net.NetApply
|
|||||||
import com.lukouguoji.module_base.ktx.commonAdapter
|
import com.lukouguoji.module_base.ktx.commonAdapter
|
||||||
import com.lukouguoji.module_base.ktx.launchCollect
|
import com.lukouguoji.module_base.ktx.launchCollect
|
||||||
import com.lukouguoji.module_base.ktx.launchLoadingCollect
|
import com.lukouguoji.module_base.ktx.launchLoadingCollect
|
||||||
|
import com.lukouguoji.module_base.ktx.showConfirmDialog
|
||||||
import com.lukouguoji.module_base.ktx.showToast
|
import com.lukouguoji.module_base.ktx.showToast
|
||||||
import com.lukouguoji.module_base.ktx.toRequestBody
|
import com.lukouguoji.module_base.ktx.toRequestBody
|
||||||
import com.lukouguoji.module_base.ktx.verifyNullOrEmpty
|
import com.lukouguoji.module_base.ktx.verifyNullOrEmpty
|
||||||
@@ -171,8 +172,49 @@ class IntExpAssembleViewModel : BasePageViewModel() {
|
|||||||
* Item点击事件处理
|
* Item点击事件处理
|
||||||
*/
|
*/
|
||||||
override fun onItemClick(position: Int, type: Int) {
|
override fun onItemClick(position: Int, type: Int) {
|
||||||
if (type == 1000) { // 展开/收起操作
|
when (type) {
|
||||||
toggleExpand(position)
|
1000 -> toggleExpand(position) // 展开/收起操作
|
||||||
|
2000 -> onEditItem(position) // 修改操作
|
||||||
|
2001 -> onDeleteSingleItem(position) // 删除操作
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改单个列表项 - 跳转到开始组装页面
|
||||||
|
*/
|
||||||
|
private fun onEditItem(position: Int) {
|
||||||
|
val bean = pageModel.rv?.commonAdapter()?.getItem(position) as? GjcUldUseBean ?: return
|
||||||
|
ARouter.getInstance()
|
||||||
|
.build(ARouterConstants.ACTIVITY_URL_INT_EXP_ASSEMBLE_START)
|
||||||
|
.withLong("useId", bean.useId)
|
||||||
|
.withString("uld", bean.uld)
|
||||||
|
.withString("fdate", bean.fdate)
|
||||||
|
.withString("fno", bean.fno)
|
||||||
|
.navigation()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除单个列表项(侧滑操作)
|
||||||
|
*/
|
||||||
|
private fun onDeleteSingleItem(position: Int) {
|
||||||
|
val bean = pageModel.rv?.commonAdapter()?.getItem(position) as? GjcUldUseBean ?: return
|
||||||
|
|
||||||
|
getTopActivity().showConfirmDialog("确定要删除该条记录吗?") {
|
||||||
|
deleteSingleItem(bean)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执行单项删除
|
||||||
|
*/
|
||||||
|
private fun deleteSingleItem(bean: GjcUldUseBean) {
|
||||||
|
val requestData = listOf(bean).toRequestBody()
|
||||||
|
|
||||||
|
launchLoadingCollect({ NetApply.api.deleteIntExpAssemble(requestData) }) {
|
||||||
|
onSuccess = {
|
||||||
|
showToast("删除成功")
|
||||||
|
refresh()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -202,24 +244,18 @@ class IntExpAssembleViewModel : BasePageViewModel() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 显示确认对话框
|
// 显示确认对话框
|
||||||
val activity = getTopActivity()
|
getTopActivity().showConfirmDialog("确定要删除选中的 ${selectedItems.size} 条记录吗?") {
|
||||||
AlertDialog.Builder(activity)
|
deleteSelectedItems(selectedItems)
|
||||||
.setTitle("删除确认")
|
}
|
||||||
.setMessage("确定要删除选中的 ${selectedItems.size} 条记录吗?")
|
|
||||||
.setPositiveButton("删除") { _, _ ->
|
|
||||||
deleteSelectedItems(selectedItems)
|
|
||||||
}
|
|
||||||
.setNegativeButton("取消", null)
|
|
||||||
.show()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除选中项
|
* 删除选中项
|
||||||
*/
|
*/
|
||||||
private fun deleteSelectedItems(items: List<GjcUldUseBean>) {
|
private fun deleteSelectedItems(items: List<GjcUldUseBean>) {
|
||||||
val ids = items.mapNotNull { it.useId }.joinToString(",")
|
val requestData = items.toRequestBody()
|
||||||
|
|
||||||
launchLoadingCollect({ NetApply.api.deleteIntExpAssemble(ids) }) {
|
launchLoadingCollect({ NetApply.api.deleteIntExpAssemble(requestData) }) {
|
||||||
onSuccess = {
|
onSuccess = {
|
||||||
showToast("删除成功")
|
showToast("删除成功")
|
||||||
refresh()
|
refresh()
|
||||||
|
|||||||
@@ -22,12 +22,18 @@
|
|||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<!-- 白色卡片 -->
|
<!-- 侧滑布局 -->
|
||||||
<LinearLayout
|
<com.mcxtzhang.swipemenulib.SwipeMenuLayout
|
||||||
|
android:id="@+id/swipe_menu"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content">
|
||||||
android:background="@drawable/bg_white_radius_8"
|
|
||||||
android:orientation="vertical">
|
<!-- 白色卡片 -->
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@drawable/bg_white_radius_8"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
<!-- 主要内容区域 -->
|
<!-- 主要内容区域 -->
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@@ -338,7 +344,31 @@
|
|||||||
android:rotation="@{bean.showMore.get() ? 180f : 0f}"
|
android:rotation="@{bean.showMore.get() ? 180f : 0f}"
|
||||||
android:src="@mipmap/img_down" />
|
android:src="@mipmap/img_down" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<!-- 侧滑菜单区域 -->
|
||||||
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<!-- 修改按钮 -->
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/btn_edit"
|
||||||
|
style="@style/tv_item_action"
|
||||||
|
android:background="@color/colorPrimary"
|
||||||
|
android:text="修改" />
|
||||||
|
|
||||||
|
<!-- 删除按钮 -->
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/btn_delete"
|
||||||
|
style="@style/tv_item_action"
|
||||||
|
android:background="@color/red"
|
||||||
|
android:text="删除" />
|
||||||
|
|
||||||
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
|
|
||||||
|
</com.mcxtzhang.swipemenulib.SwipeMenuLayout>
|
||||||
|
|
||||||
<!-- 子列表容器 -->
|
<!-- 子列表容器 -->
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
|||||||
Reference in New Issue
Block a user