feat: 国际出港查询
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
package com.lukouguoji.gjc.dialog
|
||||
|
||||
import android.content.Context
|
||||
import android.view.View
|
||||
import android.widget.TextView
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import com.lukouguoji.gjc.R
|
||||
import com.lukouguoji.gjc.databinding.DialogGjcQueryFilterBinding
|
||||
import com.lukouguoji.module_base.base.BaseDialogModel
|
||||
import com.lxj.xpopup.XPopup
|
||||
import dev.utils.app.ScreenUtils
|
||||
import dev.utils.app.info.KeyValue
|
||||
|
||||
/**
|
||||
* 国际出港查询筛选抽屉
|
||||
*/
|
||||
class GjcQueryFilterDialogModel(
|
||||
val spCode: MutableLiveData<String>, // 特码
|
||||
val dest: MutableLiveData<String>, // 目的港
|
||||
val awbType: MutableLiveData<String>, // 运单类型
|
||||
val businessType: MutableLiveData<String>, // 业务类型
|
||||
val goodsCn: MutableLiveData<String>, // 品名(中)
|
||||
private val onConfirm: () -> Unit
|
||||
) : BaseDialogModel<DialogGjcQueryFilterBinding>(DIALOG_TYPE_DRAWER) {
|
||||
|
||||
// 运单类型列表
|
||||
val awbTypeList = MutableLiveData(
|
||||
listOf(
|
||||
KeyValue("全部", ""),
|
||||
KeyValue("主单", "1"),
|
||||
KeyValue("分单", "2")
|
||||
)
|
||||
)
|
||||
|
||||
// 业务类型列表
|
||||
val businessTypeList = MutableLiveData(
|
||||
listOf(
|
||||
KeyValue("全部", ""),
|
||||
KeyValue("普货", "1"),
|
||||
KeyValue("特货", "2")
|
||||
)
|
||||
)
|
||||
|
||||
override fun layoutId() = R.layout.dialog_gjc_query_filter
|
||||
|
||||
override fun onBuild(builder: XPopup.Builder) {
|
||||
super.onBuild(builder)
|
||||
// 设置抽屉宽度为屏幕宽度的1/3
|
||||
builder.maxWidth((ScreenUtils.getScreenWidth() / 3.0).toInt())
|
||||
}
|
||||
|
||||
override fun onDialogCreated(context: Context) {
|
||||
binding.model = this
|
||||
binding.lifecycleOwner = context as? androidx.lifecycle.LifecycleOwner
|
||||
|
||||
// 设置标题
|
||||
binding.root.findViewById<TextView>(R.id.title_name)?.text = "筛选条件"
|
||||
|
||||
// 返回按钮
|
||||
binding.root.findViewById<View>(R.id.tool_back)?.setOnClickListener {
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置筛选条件
|
||||
*/
|
||||
fun onResetClick() {
|
||||
spCode.value = ""
|
||||
dest.value = ""
|
||||
awbType.value = ""
|
||||
businessType.value = ""
|
||||
goodsCn.value = ""
|
||||
}
|
||||
|
||||
/**
|
||||
* 确认筛选
|
||||
*/
|
||||
fun onConfirmClick() {
|
||||
dismiss()
|
||||
onConfirm()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user