feat: 国际进港理货报告四个操作按钮功能实现
实现人工放行、状态重置、删除理货、理货申报四个按钮的完整业务逻辑, 新增删除申报和状态重置弹框组件,对接后端API接口。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
package com.lukouguoji.gjj.dialog
|
||||
|
||||
import android.content.Context
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import com.lukouguoji.gjj.R
|
||||
import com.lukouguoji.gjj.databinding.DialogIntImpTallyDeleteBinding
|
||||
import com.lukouguoji.module_base.base.BaseDialogModel
|
||||
import com.lukouguoji.module_base.ktx.verifyNullOrEmpty
|
||||
import dev.utils.app.info.KeyValue
|
||||
|
||||
/**
|
||||
* 国际进港理货 - 删除申报对话框
|
||||
*/
|
||||
class IntImpTallyDeleteDialogModel(
|
||||
val changeReasonList: List<KeyValue>, // 变更原因列表
|
||||
private val callback: (IntImpTallyDeleteDialogModel) -> Unit
|
||||
) : BaseDialogModel<DialogIntImpTallyDeleteBinding>(DIALOG_TYPE_CENTER) {
|
||||
|
||||
// 变更原因代码(存储的是 code)
|
||||
val changeReason = MutableLiveData("")
|
||||
|
||||
// 联系人姓名
|
||||
val contactName = MutableLiveData("")
|
||||
|
||||
// 联系人电话
|
||||
val contactPhone = MutableLiveData("")
|
||||
|
||||
override fun layoutId(): Int {
|
||||
return R.layout.dialog_int_imp_tally_delete
|
||||
}
|
||||
|
||||
override fun onDialogCreated(context: Context) {
|
||||
binding.model = this
|
||||
}
|
||||
|
||||
/**
|
||||
* 确认按钮点击
|
||||
*/
|
||||
fun onConfirmClick() {
|
||||
// 验证变更原因
|
||||
if (changeReason.value.verifyNullOrEmpty("请选择变更原因")) {
|
||||
return
|
||||
}
|
||||
|
||||
// 验证联系人姓名
|
||||
if (contactName.value.verifyNullOrEmpty("请输入联系人姓名")) {
|
||||
return
|
||||
}
|
||||
|
||||
// 验证联系人电话
|
||||
if (contactPhone.value.verifyNullOrEmpty("请输入联系人电话")) {
|
||||
return
|
||||
}
|
||||
|
||||
dismiss()
|
||||
callback(this)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.lukouguoji.gjj.dialog
|
||||
|
||||
import android.content.Context
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import com.lukouguoji.gjj.R
|
||||
import com.lukouguoji.gjj.databinding.DialogIntImpTallyResetBinding
|
||||
import com.lukouguoji.module_base.base.BaseDialogModel
|
||||
import com.lukouguoji.module_base.ktx.verifyNullOrEmpty
|
||||
import dev.utils.app.info.KeyValue
|
||||
|
||||
/**
|
||||
* 国际进港理货 - 状态重置对话框
|
||||
*/
|
||||
class IntImpTallyResetDialogModel(
|
||||
private val callback: (IntImpTallyResetDialogModel) -> Unit
|
||||
) : BaseDialogModel<DialogIntImpTallyResetBinding>(DIALOG_TYPE_CENTER) {
|
||||
|
||||
// 重置状态列表
|
||||
val resetStatusList = MutableLiveData<List<KeyValue>>()
|
||||
|
||||
// 选中的重置状态(存储的是value)
|
||||
val selectedResetStatus = MutableLiveData("")
|
||||
|
||||
// 重置状态code (传给后端的restStatus参数)
|
||||
var resetStatusCode: String? = null
|
||||
|
||||
override fun layoutId(): Int {
|
||||
return R.layout.dialog_int_imp_tally_reset
|
||||
}
|
||||
|
||||
override fun onDialogCreated(context: Context) {
|
||||
binding.model = this
|
||||
initResetStatusList()
|
||||
|
||||
// 监听选择变化,更新resetStatusCode
|
||||
selectedResetStatus.observeForever { value ->
|
||||
resetStatusCode = when (value) {
|
||||
"01" -> "01" // 正常
|
||||
"02" -> null // 未申报
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化重置状态列表
|
||||
*/
|
||||
private fun initResetStatusList() {
|
||||
val list = listOf(
|
||||
KeyValue("正常", "01"),
|
||||
KeyValue("未申报", "02")
|
||||
)
|
||||
resetStatusList.value = list
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存按钮点击
|
||||
*/
|
||||
fun onSaveClick() {
|
||||
if (selectedResetStatus.value.verifyNullOrEmpty("请选择重置状态")) {
|
||||
return
|
||||
}
|
||||
dismiss()
|
||||
callback(this)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user