feat: visa

This commit is contained in:
2026-03-22 22:28:40 +08:00
parent d2a0648238
commit c7bf51bd9a
7 changed files with 143 additions and 110 deletions

View File

@@ -47,7 +47,9 @@ fun setDataLayoutData(
hint?.let { hint?.let {
dataLayout.hint = hint dataLayout.hint = hint
} }
dataLayout.icon = icon icon?.let {
dataLayout.icon = it
}
} }
@@ -189,7 +191,9 @@ fun setDataLayoutDataNew(
hint?.let { hint?.let {
dataLayout.hint = hint dataLayout.hint = hint
} }
dataLayout.icon = icon icon?.let {
dataLayout.icon = it
}
} }
@@ -293,108 +297,108 @@ fun setTextAllCapsNew(layout: PadDataLayoutNew, textAllCaps: Boolean) {
} else { } else {
layout.et.filters = emptyArray<InputFilter>() layout.et.filters = emptyArray<InputFilter>()
} }
} }
// ========== 自动查询功能 BindingAdapter新增 ========== // ========== 自动查询功能 BindingAdapter新增 ==========
/** /**
* 启用自动查询功能 * 启用自动查询功能
* @param enabled 是否启用 * @param enabled 是否启用
*/ */
@BindingAdapter("autoQueryEnabled") @BindingAdapter("autoQueryEnabled")
fun setAutoQueryEnabled(layout: PadDataLayoutNew, enabled: Boolean) { fun setAutoQueryEnabled(layout: PadDataLayoutNew, enabled: Boolean) {
layout.autoQueryConfig.enabled = enabled layout.autoQueryConfig.enabled = enabled
} }
/** /**
* 设置查询接口地址 * 设置查询接口地址
* @param url 接口地址(如:/IntExpCheckIn/checked/queryWbNoList * @param url 接口地址(如:/IntExpCheckIn/checked/queryWbNoList
*/ */
@BindingAdapter("autoQueryUrl") @BindingAdapter("autoQueryUrl")
fun setAutoQueryUrl(layout: PadDataLayoutNew, url: String?) { fun setAutoQueryUrl(layout: PadDataLayoutNew, url: String?) {
layout.autoQueryConfig.url = url ?: "" layout.autoQueryConfig.url = url ?: ""
} }
/** /**
* 设置查询参数的 key 名称 * 设置查询参数的 key 名称
* @param paramKey 参数名(默认 "value" * @param paramKey 参数名(默认 "value"
*/ */
@BindingAdapter("autoQueryParamKey") @BindingAdapter("autoQueryParamKey")
fun setAutoQueryParamKey(layout: PadDataLayoutNew, paramKey: String?) { fun setAutoQueryParamKey(layout: PadDataLayoutNew, paramKey: String?) {
layout.autoQueryConfig.paramKey = paramKey ?: "value" layout.autoQueryConfig.paramKey = paramKey ?: "value"
} }
/** /**
* 设置触发查询的最小长度 * 设置触发查询的最小长度
* @param minLength 最小长度(默认 4 * @param minLength 最小长度(默认 4
*/ */
@BindingAdapter("autoQueryMinLength") @BindingAdapter("autoQueryMinLength")
fun setAutoQueryMinLength(layout: PadDataLayoutNew, minLength: Int?) { fun setAutoQueryMinLength(layout: PadDataLayoutNew, minLength: Int?) {
layout.autoQueryConfig.minLength = minLength ?: 4 layout.autoQueryConfig.minLength = minLength ?: 4
} }
/** /**
* 设置触发查询的最大长度 * 设置触发查询的最大长度
* @param maxLength 最大长度(默认 8 * @param maxLength 最大长度(默认 8
*/ */
@BindingAdapter("autoQueryMaxLength") @BindingAdapter("autoQueryMaxLength")
fun setAutoQueryMaxLength(layout: PadDataLayoutNew, maxLength: Int?) { fun setAutoQueryMaxLength(layout: PadDataLayoutNew, maxLength: Int?) {
layout.autoQueryConfig.maxLength = maxLength ?: 8 layout.autoQueryConfig.maxLength = maxLength ?: 8
} }
/** /**
* 设置弹框标题 * 设置弹框标题
* @param title 标题(默认 "请选择" * @param title 标题(默认 "请选择"
*/ */
@BindingAdapter("autoQueryTitle") @BindingAdapter("autoQueryTitle")
fun setAutoQueryTitle(layout: PadDataLayoutNew, title: String?) { fun setAutoQueryTitle(layout: PadDataLayoutNew, title: String?) {
layout.autoQueryConfig.title = title ?: "请选择" layout.autoQueryConfig.title = title ?: "请选择"
} }
/** /**
* 设置防抖延迟 * 设置防抖延迟
* @param debounceMillis 延迟毫秒数(默认 300ms * @param debounceMillis 延迟毫秒数(默认 300ms
*/ */
@BindingAdapter("autoQueryDebounce") @BindingAdapter("autoQueryDebounce")
fun setAutoQueryDebounce(layout: PadDataLayoutNew, debounceMillis: Long?) { fun setAutoQueryDebounce(layout: PadDataLayoutNew, debounceMillis: Long?) {
layout.autoQueryConfig.debounceMillis = debounceMillis ?: 300L layout.autoQueryConfig.debounceMillis = debounceMillis ?: 300L
} }
/** /**
* 统一配置自动查询(所有属性设置完成后调用) * 统一配置自动查询(所有属性设置完成后调用)
* *
* ⚠️ 重要:必须在所有 autoQuery* 属性之后绑定,使用 requireAll = false * ⚠️ 重要:必须在所有 autoQuery* 属性之后绑定,使用 requireAll = false
*/ */
@BindingAdapter( @BindingAdapter(
"autoQueryEnabled", "autoQueryEnabled",
"autoQueryUrl", "autoQueryUrl",
"autoQueryParamKey", "autoQueryParamKey",
"autoQueryMinLength", "autoQueryMinLength",
"autoQueryMaxLength", "autoQueryMaxLength",
"autoQueryTitle", "autoQueryTitle",
"autoQueryDebounce", "autoQueryDebounce",
requireAll = false requireAll = false
) )
fun configureAutoQuery( fun configureAutoQuery(
layout: PadDataLayoutNew, layout: PadDataLayoutNew,
enabled: Boolean?, enabled: Boolean?,
url: String?, url: String?,
paramKey: String?, paramKey: String?,
minLength: Int?, minLength: Int?,
maxLength: Int?, maxLength: Int?,
title: String?, title: String?,
debounceMillis: Long? debounceMillis: Long?
) { ) {
// 应用所有配置 // 应用所有配置
enabled?.let { layout.autoQueryConfig.enabled = it } enabled?.let { layout.autoQueryConfig.enabled = it }
url?.let { layout.autoQueryConfig.url = it } url?.let { layout.autoQueryConfig.url = it }
paramKey?.let { layout.autoQueryConfig.paramKey = it } paramKey?.let { layout.autoQueryConfig.paramKey = it }
minLength?.let { layout.autoQueryConfig.minLength = it } minLength?.let { layout.autoQueryConfig.minLength = it }
maxLength?.let { layout.autoQueryConfig.maxLength = it } maxLength?.let { layout.autoQueryConfig.maxLength = it }
title?.let { layout.autoQueryConfig.title = it } title?.let { layout.autoQueryConfig.title = it }
debounceMillis?.let { layout.autoQueryConfig.debounceMillis = it } debounceMillis?.let { layout.autoQueryConfig.debounceMillis = it }
// 验证并启用自动查询 // 验证并启用自动查询
if (layout.autoQueryConfig.isValid()) { if (layout.autoQueryConfig.isValid()) {
layout.enableAutoQuery(layout.autoQueryConfig) layout.enableAutoQuery(layout.autoQueryConfig)
} }
} }

View File

@@ -212,6 +212,11 @@ class PadDataLayout : FrameLayout {
et.visibility = GONE et.visibility = GONE
spinner.visibility = GONE spinner.visibility = GONE
tvSpinner.visibility = GONE tvSpinner.visibility = GONE
iv.visibility = VISIBLE
iv.setImageResource(R.mipmap.img_date)
val dp20 = dev.utils.app.SizeUtils.dp2px(20f)
iv.layoutParams.width = dp20
iv.layoutParams.height = dp20
setOnClickListener(dateClick) setOnClickListener(dateClick)
} }

View File

@@ -240,6 +240,11 @@ class PadDataLayoutNew : FrameLayout {
et.visibility = GONE et.visibility = GONE
spinner.visibility = GONE spinner.visibility = GONE
tvSpinner.visibility = GONE tvSpinner.visibility = GONE
iv.visibility = VISIBLE
iv.setImageResource(R.mipmap.img_date)
val dp20 = dev.utils.app.SizeUtils.dp2px(20f)
iv.layoutParams.width = dp20
iv.layoutParams.height = dp20
setOnClickListener(dateClick) setOnClickListener(dateClick)
} }

View File

@@ -10,9 +10,9 @@
<RelativeLayout <RelativeLayout
android:id="@+id/rl" android:id="@+id/rl"
android:layout_width="match_parent" android:layout_width="100dp"
android:layout_height="150dp" android:layout_height="100dp"
android:layout_margin="10dp" android:layout_margin="5dp"
android:background="@color/white"> android:background="@color/white">
<ImageView <ImageView

View File

@@ -10,6 +10,7 @@ import com.lukouguoji.module_base.base.BaseBindingActivity
import com.lukouguoji.module_base.common.Constant import com.lukouguoji.module_base.common.Constant
import com.lukouguoji.module_base.common.DetailsPageType import com.lukouguoji.module_base.common.DetailsPageType
import com.lukouguoji.module_base.ktx.addOnItemClickListener import com.lukouguoji.module_base.ktx.addOnItemClickListener
import com.lukouguoji.module_base.ktx.setUpperCaseAlphanumericFilter
/** /**
* 国际进港-事故签证新增/编辑 * 国际进港-事故签证新增/编辑
@@ -23,6 +24,11 @@ class IntImpAccidentVisaEditActivity :
override fun initOnCreate(savedInstanceState: Bundle?) { override fun initOnCreate(savedInstanceState: Bundle?) {
binding.viewModel = viewModel binding.viewModel = viewModel
// 航班号:大写字母+数字
binding.fnoInput.et.setUpperCaseAlphanumericFilter()
// 运单号:大写字母+数字
binding.wbNoInput.et.setUpperCaseAlphanumericFilter()
viewModel.rv = binding.rv viewModel.rv = binding.rv
binding.rv.addOnItemClickListener(viewModel) binding.rv.addOnItemClickListener(viewModel)
viewModel.initOnCreate(intent) viewModel.initOnCreate(intent)

View File

@@ -17,6 +17,7 @@ import com.lukouguoji.module_base.impl.FlowBus
import com.lukouguoji.module_base.impl.ImageSelectViewHolder import com.lukouguoji.module_base.impl.ImageSelectViewHolder
import com.lukouguoji.module_base.interfaces.IOnItemClickListener import com.lukouguoji.module_base.interfaces.IOnItemClickListener
import com.lukouguoji.module_base.ktx.commonAdapter import com.lukouguoji.module_base.ktx.commonAdapter
import com.lukouguoji.module_base.ktx.formatDate
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.noNull import com.lukouguoji.module_base.ktx.noNull
@@ -26,6 +27,7 @@ import com.lukouguoji.module_base.ktx.verifyNullOrEmpty
import com.lukouguoji.module_base.util.MediaUtil import com.lukouguoji.module_base.util.MediaUtil
import com.lukouguoji.module_base.util.UploadUtil import com.lukouguoji.module_base.util.UploadUtil
import dev.utils.app.info.KeyValue import dev.utils.app.info.KeyValue
import dev.utils.common.DateUtils
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.asFlow import kotlinx.coroutines.flow.asFlow
import kotlinx.coroutines.flow.catch import kotlinx.coroutines.flow.catch
@@ -71,6 +73,13 @@ class IntImpAccidentVisaEditViewModel : BaseViewModel(), IOnItemClickListener {
id = intent.getLongExtra(Constant.Key.ID, 0) id = intent.getLongExtra(Constant.Key.ID, 0)
pageType.value = if (id == 0L) DetailsPageType.Add else DetailsPageType.Modify pageType.value = if (id == 0L) DetailsPageType.Add else DetailsPageType.Modify
// 新增模式下默认航班日期为今天
if (pageType.value == DetailsPageType.Add) {
val bean = dataBean.value ?: GjAccidentVisaEditBean()
bean.fdate = DateUtils.getCurrentTime().formatDate()
dataBean.value = bean
}
loadDropdownLists() loadDropdownLists()
if (id != 0L) { if (id != 0L) {

View File

@@ -59,6 +59,7 @@
value='@={viewModel.dataBean.fdate}' /> value='@={viewModel.dataBean.fdate}' />
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew <com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
android:id="@+id/fnoInput"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
@@ -84,6 +85,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
enable="@{false}" enable="@{false}"
hint='@{"航班信息自动填充"}'
title='@{"始发站"}' title='@{"始发站"}'
titleLength="@{6}" titleLength="@{6}"
type="@{DataLayoutType.INPUT}" type="@{DataLayoutType.INPUT}"
@@ -94,6 +96,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
enable="@{false}" enable="@{false}"
hint='@{"航班信息自动填充"}'
title='@{"目的站"}' title='@{"目的站"}'
titleLength="@{6}" titleLength="@{6}"
type="@{DataLayoutType.INPUT}" type="@{DataLayoutType.INPUT}"
@@ -109,6 +112,7 @@
android:orientation="horizontal"> android:orientation="horizontal">
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew <com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
android:id="@+id/wbNoInput"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"