feat: 国际出港 收运检查 退回 list
This commit is contained in:
@@ -0,0 +1,40 @@
|
|||||||
|
package com.lukouguoji.gjc.dialog
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import androidx.lifecycle.MutableLiveData
|
||||||
|
import com.lukouguoji.gjc.R
|
||||||
|
import com.lukouguoji.gjc.databinding.DialogGjcInspectionRejectBinding
|
||||||
|
import com.lukouguoji.module_base.base.BaseDialogModel
|
||||||
|
import com.lukouguoji.module_base.ktx.verifyNullOrEmpty
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 国际出港收运检查 - 退回原因对话框
|
||||||
|
*/
|
||||||
|
class GjcInspectionRejectDialogModel(
|
||||||
|
private val callback: (String) -> Unit // 回调传递退回原因
|
||||||
|
) : BaseDialogModel<DialogGjcInspectionRejectBinding>(DIALOG_TYPE_CENTER) {
|
||||||
|
|
||||||
|
// 退回原因
|
||||||
|
val rejectReason = MutableLiveData("")
|
||||||
|
|
||||||
|
override fun layoutId(): Int {
|
||||||
|
return R.layout.dialog_gjc_inspection_reject
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onDialogCreated(context: Context) {
|
||||||
|
binding.model = this
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存按钮点击
|
||||||
|
*/
|
||||||
|
fun onConfirmClick() {
|
||||||
|
// 验证退回原因
|
||||||
|
if (rejectReason.value.verifyNullOrEmpty("请输入退回原因")) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
dismiss()
|
||||||
|
callback(rejectReason.value!!)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,6 +5,7 @@ import android.content.Intent
|
|||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import androidx.lifecycle.viewModelScope
|
import androidx.lifecycle.viewModelScope
|
||||||
import com.lukouguoji.gjc.R
|
import com.lukouguoji.gjc.R
|
||||||
|
import com.lukouguoji.gjc.dialog.GjcInspectionRejectDialogModel
|
||||||
import com.lukouguoji.gjc.holder.GjcInspectionViewHolder
|
import com.lukouguoji.gjc.holder.GjcInspectionViewHolder
|
||||||
import com.lukouguoji.module_base.base.BasePageViewModel
|
import com.lukouguoji.module_base.base.BasePageViewModel
|
||||||
import com.lukouguoji.module_base.bean.GjcInspectionBean
|
import com.lukouguoji.module_base.bean.GjcInspectionBean
|
||||||
@@ -157,7 +158,7 @@ class GjcInspectionViewModel : BasePageViewModel() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
getTopActivity().showConfirmDialog("确定要通过选中的 ${filter.size} 条数据吗?") {
|
getTopActivity().showConfirmDialog("确定要通过选中的 ${filter.size} 条数据吗?") {
|
||||||
performAudit(filter, true, "通过")
|
performAudit(filter, true, "通过", "")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,13 +168,25 @@ class GjcInspectionViewModel : BasePageViewModel() {
|
|||||||
fun auditRejectClick() {
|
fun auditRejectClick() {
|
||||||
val list = pageModel.rv!!.commonAdapter()!!.items as List<GjcInspectionBean>
|
val list = pageModel.rv!!.commonAdapter()!!.items as List<GjcInspectionBean>
|
||||||
val filter = list.filter { it.checked.get() }
|
val filter = list.filter { it.checked.get() }
|
||||||
|
|
||||||
|
// 验证是否选择了数据
|
||||||
if (filter.isEmpty()) {
|
if (filter.isEmpty()) {
|
||||||
showToast("请选择数据")
|
showToast("请选择数据")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
getTopActivity().showConfirmDialog("确定要退回选中的 ${filter.size} 条数据吗?") {
|
|
||||||
performAudit(filter, false, "退回")
|
// 验证只能选择一个单据
|
||||||
|
if (filter.size > 1) {
|
||||||
|
showToast("退回时只能选择一个单据")
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 弹出退回原因对话框
|
||||||
|
val dialog = GjcInspectionRejectDialogModel { reason ->
|
||||||
|
// 用户填写完退回原因后,执行退回操作
|
||||||
|
performAudit(filter, false, "退回", reason)
|
||||||
|
}
|
||||||
|
dialog.show()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -181,8 +194,9 @@ class GjcInspectionViewModel : BasePageViewModel() {
|
|||||||
* @param items 选中的数据列表
|
* @param items 选中的数据列表
|
||||||
* @param isPass true:通过, false:退回
|
* @param isPass true:通过, false:退回
|
||||||
* @param action 操作名称(用于提示)
|
* @param action 操作名称(用于提示)
|
||||||
|
* @param reason 退回原因(仅退回时使用)
|
||||||
*/
|
*/
|
||||||
private fun performAudit(items: List<GjcInspectionBean>, isPass: Boolean, action: String) {
|
private fun performAudit(items: List<GjcInspectionBean>, isPass: Boolean, action: String, reason: String) {
|
||||||
// 构建请求参数:数组对象,包含 maWbId、wbNo、prefix、no、reviewStatus(必传)
|
// 构建请求参数:数组对象,包含 maWbId、wbNo、prefix、no、reviewStatus(必传)
|
||||||
// 使用数据自身的 reviewStatus 值
|
// 使用数据自身的 reviewStatus 值
|
||||||
val requestData = items.map {
|
val requestData = items.map {
|
||||||
@@ -200,8 +214,7 @@ class GjcInspectionViewModel : BasePageViewModel() {
|
|||||||
if (isPass) {
|
if (isPass) {
|
||||||
NetApply.api.passGjcInspection(requestData)
|
NetApply.api.passGjcInspection(requestData)
|
||||||
} else {
|
} else {
|
||||||
// TODO: impl reason dialog
|
NetApply.api.backGjcInspection(reason, requestData)
|
||||||
NetApply.api.backGjcInspection("test reason", requestData)
|
|
||||||
}
|
}
|
||||||
}) {
|
}) {
|
||||||
onSuccess = {
|
onSuccess = {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
<data>
|
<data>
|
||||||
|
|
||||||
@@ -212,7 +213,8 @@
|
|||||||
android:id="@+id/rv_waybill_list"
|
android:id="@+id/rv_waybill_list"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:layout_weight="1" />
|
android:layout_weight="1"
|
||||||
|
tools:listitem="@layout/item_assemble_waybill"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<!-- ULD信息卡片 -->
|
<!-- ULD信息卡片 -->
|
||||||
|
|||||||
@@ -0,0 +1,73 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<layout xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<data>
|
||||||
|
<import type="com.lukouguoji.module_base.ui.weight.data.layout.DataLayoutType"/>
|
||||||
|
|
||||||
|
<variable
|
||||||
|
name="model"
|
||||||
|
type="com.lukouguoji.gjc.dialog.GjcInspectionRejectDialogModel" />
|
||||||
|
|
||||||
|
</data>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="600dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@drawable/bg_dialog_f2_radius_10"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<!-- 标题栏 -->
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:background="@drawable/bg_primary_radius_top_10"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="是否确认退回?"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="18sp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<!-- 表单内容 -->
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginHorizontal="30dp"
|
||||||
|
android:layout_marginTop="30dp"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<!-- 退回原因(多行输入) -->
|
||||||
|
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
||||||
|
enable="@{true}"
|
||||||
|
inputHeight="@{120}"
|
||||||
|
title='@{"原因"}'
|
||||||
|
titleLength="@{5}"
|
||||||
|
hint='@{"请输入退回原因"}'
|
||||||
|
type="@{DataLayoutType.INPUT}"
|
||||||
|
value='@={model.rejectReason}'
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<!-- 底部按钮 -->
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="40dp"
|
||||||
|
android:layout_marginBottom="20dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
style="@style/tv_bottom_btn"
|
||||||
|
android:onClick="@{()->model.dismiss()}"
|
||||||
|
android:text="取消" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
style="@style/tv_bottom_btn"
|
||||||
|
android:onClick="@{()->model.onConfirmClick()}"
|
||||||
|
android:text="保存" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
</layout>
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:paddingHorizontal="8dp"
|
android:paddingHorizontal="8dp"
|
||||||
android:paddingVertical="12dp">
|
android:paddingVertical="4dp">
|
||||||
|
|
||||||
<!-- 序号 -->
|
<!-- 序号 -->
|
||||||
<TextView
|
<TextView
|
||||||
|
|||||||
Reference in New Issue
Block a user