Compare commits

...

3 Commits

Author SHA1 Message Date
9e0a26f3bc feat: 进港签证 2026-03-26 12:03:09 +08:00
3918ad64d6 feat: 新增图片选择控件并修正事故签证字段
- 新增 ImageSelectNewViewHolder 和 item_image_select_new 布局,支持正方形缩略图、
  加号按钮始终在末尾、详情模式隐藏加号及"暂无图片"占位
- 国际事故签证编辑页和国内进港移交页应用新图片选择控件
- 修正事故签证字段:reweight → reWeight,opName/opDate → opId/opdate

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-26 12:02:16 +08:00
88bbd73fa1 fix: 国际事故签证新增时不传 id 字段
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-26 10:25:03 +08:00
19 changed files with 1320 additions and 575 deletions

View File

@@ -113,7 +113,9 @@
"mcp__apifox__read_project_oas_6i29va",
"mcp__apifox__read_project_oas_ref_resources_6i29va",
"mcp__plugin_claude-mem_mcp-search__smart_search",
"Bash(echo \"exit:$?\")"
"Bash(echo \"exit:$?\")",
"mcp__apifox__read_project_oas_j7j64k",
"mcp__apifox__read_project_oas_ref_resources_j7j64k"
],
"deny": [],
"ask": []

View File

@@ -383,6 +383,27 @@
android:configChanges="orientation|keyboardHidden"
android:screenOrientation="userLandscape"/>
<activity
android:name="com.lukouguoji.gnj.page.yiku.list.GnjYiKuListActivity"
android:configChanges="orientation|keyboardHidden"
android:exported="false"
android:screenOrientation="userLandscape" />
<activity
android:name="com.lukouguoji.gnj.page.yiku.edit.GnjYiKuEditActivity"
android:configChanges="orientation|keyboardHidden"
android:exported="false"
android:screenOrientation="userLandscape" />
<activity
android:name="com.lukouguoji.gnj.page.yiku.details.GnjYiKuDetailsActivity"
android:configChanges="orientation|keyboardHidden"
android:exported="false"
android:screenOrientation="userLandscape" />
<activity
android:name="com.lukouguoji.gnj.page.yiku.handover.GnjYiKuHandoverActivity"
android:configChanges="orientation|keyboardHidden"
android:exported="false"
android:screenOrientation="userLandscape" />
<!-- 国际进港-电报解析 -->
<activity
android:name="com.lukouguoji.gjj.activity.IntImpMsgParseActivity"

View File

@@ -2,9 +2,9 @@ package com.lukouguoji.aerologic.page.gnj.move.stash.list
import android.view.View
import com.lukouguoji.aerologic.databinding.ItemGnjMoveStashListBinding
import com.lukouguoji.gnj.page.yiku.handover.GnjYiKuHandoverActivity
import com.lukouguoji.module_base.base.BaseViewHolder
import com.lukouguoji.module_base.bean.MoveStashBean
import com.lukouguoji.module_base.bean.SimpleCheckBean
class GnjMoveStashListViewHolder(view: View) :
BaseViewHolder<MoveStashBean, ItemGnjMoveStashListBinding>(view) {
@@ -16,6 +16,16 @@ class GnjMoveStashListViewHolder(view: View) :
binding.ivIcon.setOnClickListener {
bean.checked.set(!bean.checked.get())
}
// 点击列表项进入移交详情
binding.ll.setOnClickListener {
GnjYiKuHandoverActivity.startForDetails(itemView.context, bean.mawbId)
}
// 侧滑菜单 - 编辑按钮
binding.btnEdit.setOnClickListener {
binding.swipeMenu.quickClose()
GnjYiKuHandoverActivity.startForEdit(itemView.context, bean.mawbId)
}
}
}

View File

@@ -10,12 +10,25 @@
type="com.lukouguoji.module_base.bean.MoveStashBean" />
</data>
<androidx.appcompat.widget.LinearLayoutCompat
android:id="@+id/ll"
<!-- 外层容器承载间距 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="15dp"
android:layout_marginVertical="5dp"
android:orientation="vertical">
<!-- 侧滑布局 -->
<com.mcxtzhang.swipemenulib.SwipeMenuLayout
android:id="@+id/swipe_menu"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!-- 主列表项容器 -->
<androidx.appcompat.widget.LinearLayoutCompat
android:id="@+id/ll"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_item"
android:orientation="horizontal"
android:padding="10dp">
@@ -29,9 +42,10 @@
android:src="@drawable/img_plane" />
<LinearLayout
android:layout_width="match_parent"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_weight="1"
android:orientation="vertical">
<androidx.appcompat.widget.LinearLayoutCompat
@@ -242,4 +256,24 @@
</LinearLayout>
</androidx.appcompat.widget.LinearLayoutCompat>
<!-- 侧滑菜单区域 -->
<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="编辑" />
</androidx.appcompat.widget.LinearLayoutCompat>
</com.mcxtzhang.swipemenulib.SwipeMenuLayout>
</LinearLayout>
</layout>

View File

@@ -10,12 +10,12 @@ class GjAccidentVisaEditBean {
var dpc: String = "" // 不正常件数
var pc: String = "" // 运单总件数
var weight: String = "" // 运单总重量
var reweight: String = "" // 复称重量
var reWeight: String = "" // 复称重量
var goods: String = "" // 品名
var opacking: String = "" // 外包装
var damage: String = "" // 包装破损情况
var condition: String = "" // 内容物情况
var problem: String = "" // 不正常类型
var kdamage: String = "" // 不正常类型
var seachDate: String = "" // 发现时间
var photo: String = "" // 图片是否留底
var remarks: String = "" // 备注

View File

@@ -16,14 +16,19 @@ class GnjYiKuBean : ICheck {
var agentCode: String = "" // 代理人
var goods: String = "" // 品名
var flight: String = "" // 进港航班(格式: 20240712/MU2023)
var route: String = "" // 航程(格式: LAX-PEK-HFE)
var route: String = "" // 航程(格式: LAX-PEK-HFE)(旧接口字段)
var range: String = "" // 航程(格式: LAX-PEK-HFE)GnjMawb 接口字段)
var origin: String = "" // 始发港
var dest: String = "" // 目的港
var awbType: String = "" // 运单类型(转国际进港/转国内出港等)
var telegramNo: String = "" // 电报号
var telegramNo: String = "" // 电报号(旧接口字段)
var telegramId: String = "" // 电报号GnjMawb 接口字段)
var remark: String = "" // 备注
var handoverStatus: String = "" // 移交状态(未移交/已移交)
var images: String = "" // 交接图片(逗号分隔的URL列表)
var originalPic: String = "" // 交接图片原图地址
var pic: String = "" // 交接图片缩略图
var picNumber: String = "" // 交接图片数量
var fdate: String = "" // 航班日期
var fno: String = "" // 航班号
var businessType: String = "" // 业务类型
@@ -41,10 +46,17 @@ class GnjYiKuBean : ICheck {
* 获取图片列表
*/
fun getImageList(): List<String> {
return if (images.isNotEmpty()) {
images.split(",").filter { it.isNotEmpty() }
val source = originalPic.ifEmpty { images }
return if (source.isNotEmpty()) {
source.split(",").filter { it.isNotEmpty() }
} else {
emptyList()
}
}
/** 获取航程(兼容新旧接口) */
fun getRouteDisplay(): String = range.ifEmpty { route }
/** 获取电报号(兼容新旧接口) */
fun getTelegramDisplay(): String = telegramId.ifEmpty { telegramNo }
}

View File

@@ -12,8 +12,8 @@ class IntImpAccidentVisaBean {
var totalPc: Int = 0 // 运单总件数
var totalWeight: Double = 0.0 // 运单总重量
var abnPc: Int = 0 // 不正常件数
var opName: String = "" // 经办人
var opDate: String = "" // 经办时间
var opId: String = "" // 经办人
var opdate: String = "" // 经办时间
val checked: ObservableBoolean = ObservableBoolean(false)

View File

@@ -1744,6 +1744,18 @@ interface Api {
@POST("DomImpMove/save")
suspend fun saveGnjYiKu(@Body data: RequestBody): BaseResultBean<SimpleResultBean>
/**
* 获取-国内进港移库-详情(新接口)
*/
@GET("DomImpMove/detail")
suspend fun getGnjMoveStashDetail(@Query("mawbId") mawbId: String): BaseResultBean<GnjYiKuBean>
/**
* 编辑-国内进港移库(新接口)
*/
@POST("DomImpMove/modify")
suspend fun modifyGnjMoveStash(@Body data: RequestBody): BaseResultBean<String>
/**
* 执行-国内进港移库操作
*/

View File

@@ -0,0 +1,66 @@
package com.lukouguoji.module_base.impl
import android.view.View
import android.view.ViewTreeObserver
import com.lukouguoji.module_base.adapter.loadImage
import com.lukouguoji.module_base.base.BaseViewHolder
import com.lukouguoji.module_base.bean.FileBean
import com.lukouguoji.module_base.databinding.ItemImageSelectNewBinding
import com.lukouguoji.module_base.ktx.commonAdapter
import com.lukouguoji.module_base.ktx.logd
import com.lukouguoji.module_base.ktx.loge
import com.lukouguoji.module_base.ui.page.preview.PreviewActivity
import com.lukouguoji.module_base.util.MediaUtil
class ImageSelectNewViewHolder(view: View) : BaseViewHolder<FileBean, ItemImageSelectNewBinding>(view) {
override fun onBind(item: Any?, position: Int) {
val bean = getItemBean(item)!!
binding.bean = bean
// 让高度等于宽度,实现正方形
binding.rl.viewTreeObserver.addOnGlobalLayoutListener(object : ViewTreeObserver.OnGlobalLayoutListener {
override fun onGlobalLayout() {
binding.rl.viewTreeObserver.removeOnGlobalLayoutListener(this)
val width = binding.rl.width
if (width > 0 && binding.rl.height != width) {
val lp = binding.rl.layoutParams
lp.height = width
binding.rl.layoutParams = lp
}
}
})
binding.rl.setOnClickListener {
if (bean.path.isEmpty()) {
MediaUtil.pickImage(itemView.context, maxNum = 10) { results ->
val adapter = getRecyclerView()?.commonAdapter() ?: return@pickImage
results.forEach { result ->
logd("添加了图片 : ${result.realPath}")
// 在加号按钮(最后一项)之前插入图片
val insertPos = adapter.items.size - 1
adapter.items.add(insertPos, FileBean(path = result.realPath))
adapter.notifyItemInserted(insertPos)
}
}
} else {
PreviewActivity.start(itemView.context, listOf(bean))
}
}
// 长按事件
binding.rl.setOnLongClickListener {
clickListener?.onItemClick(bindingAdapterPosition, binding.rl.id)
true
}
notifyItemClick(position, binding.ivDelete)
if (bean.isOnlineResource()) {
loge("开始下载 : ${bean.path}")
bean.download {
loadImage(binding.iv, it)
}
}
}
}

View File

@@ -106,6 +106,7 @@ object ARouterConstants {
const val ACTIVITY_URL_GNJ_YIKU_LIST = "/gnj/GnjYiKuListActivity" //国内进港 移库列表
const val ACTIVITY_URL_GNJ_YIKU_DETAILS = "/gnj/GnjYiKuDetailsActivity" //国内进港 移库详情
const val ACTIVITY_URL_GNJ_YIKU_EDIT = "/gnj/GnjYiKuEditActivity" //国内进港 移库编辑
const val ACTIVITY_URL_GNJ_YIKU_HANDOVER = "/gnj/GnjYiKuHandoverActivity" //国内进港 移交编辑/详情
///////////////// 国际出港模块
/**

View File

@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<data>
<variable
name="bean"
type="com.lukouguoji.module_base.bean.FileBean" />
</data>
<RelativeLayout
android:id="@+id/rl"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_margin="5dp"
android:background="@color/white">
<ImageView
visible="@{bean.path.length() == 0}"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_centerInParent="true"
android:src="@drawable/img_add" />
<ImageView
android:id="@+id/iv"
loadImage="@{bean.path}"
visible="@{bean.path}"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop" />
<View
visible="@{bean.canDelete}"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black_tran10" />
<ImageView
android:id="@+id/iv_delete"
visible="@{bean.canDelete}"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_centerInParent="true"
android:src="@drawable/img_delete_red" />
</RelativeLayout>
</layout>

View File

@@ -14,7 +14,7 @@ import com.lukouguoji.module_base.common.ConstantEvent
import com.lukouguoji.module_base.common.DetailsPageType
import com.lukouguoji.module_base.http.net.NetApply
import com.lukouguoji.module_base.impl.FlowBus
import com.lukouguoji.module_base.impl.ImageSelectViewHolder
import com.lukouguoji.module_base.impl.ImageSelectNewViewHolder
import com.lukouguoji.module_base.interfaces.IOnItemClickListener
import com.lukouguoji.module_base.ktx.commonAdapter
import com.lukouguoji.module_base.ktx.formatDate
@@ -23,6 +23,8 @@ import com.lukouguoji.module_base.ktx.launchLoadingCollect
import com.lukouguoji.module_base.ktx.noNull
import com.lukouguoji.module_base.ktx.showToast
import com.lukouguoji.module_base.ktx.toRequestBody
import okhttp3.MediaType.Companion.toMediaTypeOrNull
import okhttp3.RequestBody.Companion.toRequestBody
import com.lukouguoji.module_base.ktx.verifyNullOrEmpty
import com.lukouguoji.module_base.util.MediaUtil
import com.lukouguoji.module_base.util.UploadUtil
@@ -49,8 +51,8 @@ class IntImpAccidentVisaEditViewModel : BaseViewModel(), IOnItemClickListener {
val dataBean = MutableLiveData(GjAccidentVisaEditBean())
// 图片列表
val itemLayoutId = R.layout.item_image_select
val itemViewHolder = ImageSelectViewHolder::class.java
val itemLayoutId = R.layout.item_image_select_new
val itemViewHolder = ImageSelectNewViewHolder::class.java
var rv: RecyclerView? = null
// 下拉列表
@@ -71,6 +73,8 @@ class IntImpAccidentVisaEditViewModel : BaseViewModel(), IOnItemClickListener {
// 是否为详情模式(只读)
val isDetailMode = MutableLiveData(false)
// 详情模式下无图片时显示占位提示
val showNoImage = MutableLiveData(false)
fun initOnCreate(intent: Intent) {
id = intent.getLongExtra(Constant.Key.ID, 0)
@@ -154,6 +158,11 @@ class IntImpAccidentVisaEditViewModel : BaseViewModel(), IOnItemClickListener {
}
}
rv?.commonAdapter()?.loadMore(picList)
// 详情模式下无图片时显示占位提示
if (isDetailMode.value == true && picList.isEmpty()) {
showNoImage.value = true
}
}
}
}
@@ -250,7 +259,10 @@ class IntImpAccidentVisaEditViewModel : BaseViewModel(), IOnItemClickListener {
bean.idFlag = "1"
if (pageType.value == DetailsPageType.Add) {
NetApply.api.saveGjAccidentVisa(bean.toRequestBody())
val jsonObj = org.json.JSONObject(NetApply.gson.toJson(bean))
jsonObj.remove("id")
val body = jsonObj.toString().toRequestBody("application/json; charset=utf-8".toMediaTypeOrNull())
NetApply.api.saveGjAccidentVisa(body)
} else {
NetApply.api.modifyGjAccidentVisa(bean.toRequestBody())
}

View File

@@ -185,7 +185,7 @@
title='@{"复称重量"}'
titleLength="@{6}"
type="@{DataLayoutType.INPUT}"
value='@={viewModel.dataBean.reweight}' />
value='@={viewModel.dataBean.reWeight}' />
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
android:layout_width="0dp"
@@ -262,7 +262,7 @@
title='@{"不正常类型"}'
titleLength="@{6}"
type="@{DataLayoutType.SPINNER}"
value='@={viewModel.dataBean.problem}' />
value='@={viewModel.dataBean.kdamage}' />
</LinearLayout>
@@ -339,8 +339,21 @@
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
app:spanCount="4"
tools:listitem="@layout/item_image_select" />
app:spanCount="6"
tools:listitem="@layout/item_image_select_new" />
<!-- 详情模式下无图片时的占位提示 -->
<TextView
android:id="@+id/tv_no_image"
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_marginTop="10dp"
android:background="@color/white"
android:gravity="center"
android:text="暂无图片"
android:textColor="@color/text_gray"
android:textSize="14sp"
android:visibility="@{viewModel.showNoImage ? View.VISIBLE : View.GONE}" />
<!-- 底部按钮(详情模式隐藏) -->
<LinearLayout

View File

@@ -262,7 +262,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{bean.opName}"
android:text="@{bean.opId}"
android:textSize="15sp" />
</androidx.appcompat.widget.LinearLayoutCompat>
@@ -284,7 +284,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{bean.opDate}"
android:text="@{bean.opdate}"
android:textSize="15sp" />
</androidx.appcompat.widget.LinearLayoutCompat>

View File

@@ -0,0 +1,64 @@
package com.lukouguoji.gnj.page.yiku.handover
import android.content.Context
import android.content.Intent
import android.os.Bundle
import com.alibaba.android.arouter.facade.annotation.Route
import com.lukouguoji.gnj.R
import com.lukouguoji.gnj.databinding.ActivityGnjYikuHandoverBinding
import com.lukouguoji.module_base.base.BaseBindingActivity
import com.lukouguoji.module_base.common.Constant
import com.lukouguoji.module_base.common.DetailsPageType
import com.lukouguoji.module_base.ktx.addOnItemClickListener
import com.lukouguoji.module_base.ktx.commonAdapter
import com.lukouguoji.module_base.router.ARouterConstants
/**
* 国内进港移交编辑/详情页
*/
@Route(path = ARouterConstants.ACTIVITY_URL_GNJ_YIKU_HANDOVER)
class GnjYiKuHandoverActivity :
BaseBindingActivity<ActivityGnjYikuHandoverBinding, GnjYiKuHandoverViewModel>() {
override fun layoutId() = R.layout.activity_gnj_yiku_handover
override fun viewModelClass() = GnjYiKuHandoverViewModel::class.java
override fun initOnCreate(savedInstanceState: Bundle?) {
viewModel.initOnCreated(intent)
when (viewModel.pageType.value) {
DetailsPageType.Modify -> setBackArrow("国内进港移交编辑")
DetailsPageType.Details -> setBackArrow("国内进港移交详情")
else -> setBackArrow("国内进港移交")
}
binding.viewModel = viewModel
// 绑定图片列表点击事件(编辑模式下可删除图片)
binding.rvImages.addOnItemClickListener(viewModel)
// 监听图片列表变化并更新 adapter
viewModel.imageList.observe(this) { images ->
binding.rvImages.commonAdapter()?.refresh(images)
}
}
companion object {
@JvmStatic
fun startForEdit(context: Context, id: String) {
val starter = Intent(context, GnjYiKuHandoverActivity::class.java)
.putExtra(Constant.Key.PAGE_TYPE, DetailsPageType.Modify.name)
.putExtra(Constant.Key.ID, id)
context.startActivity(starter)
}
@JvmStatic
fun startForDetails(context: Context, id: String) {
val starter = Intent(context, GnjYiKuHandoverActivity::class.java)
.putExtra(Constant.Key.PAGE_TYPE, DetailsPageType.Details.name)
.putExtra(Constant.Key.ID, id)
context.startActivity(starter)
}
}
}

View File

@@ -0,0 +1,136 @@
package com.lukouguoji.gnj.page.yiku.handover
import android.content.Intent
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.viewModelScope
import com.lukouguoji.gnj.R
import com.lukouguoji.module_base.base.BaseViewModel
import com.lukouguoji.module_base.bean.FileBean
import com.lukouguoji.module_base.bean.GnjYiKuBean
import com.lukouguoji.module_base.common.Constant
import com.lukouguoji.module_base.common.ConstantEvent
import com.lukouguoji.module_base.common.DetailsPageType
import com.lukouguoji.module_base.http.net.NetApply
import com.lukouguoji.module_base.impl.FlowBus
import com.lukouguoji.module_base.impl.ImageSelectNewViewHolder
import com.lukouguoji.module_base.interfaces.IOnItemClickListener
import com.lukouguoji.module_base.ktx.launchLoadingCollect
import com.lukouguoji.module_base.ktx.showToast
import com.lukouguoji.module_base.ktx.toRequestBody
import com.lukouguoji.module_base.util.UploadUtil
import kotlinx.coroutines.launch
/**
* 国内进港移交编辑/详情 ViewModel
*/
class GnjYiKuHandoverViewModel : BaseViewModel(), IOnItemClickListener {
val pageType = MutableLiveData(DetailsPageType.Modify)
var mawbId = ""
val dataBean = MutableLiveData(GnjYiKuBean())
// 图片列表
val imageList = MutableLiveData<MutableList<FileBean>>(mutableListOf())
// 图片适配器配置
val imageItemLayoutId = R.layout.item_image_select_new
val imageItemViewHolder = ImageSelectNewViewHolder::class.java
// 详情模式下无图片时显示占位提示
val showNoImage = MutableLiveData(false)
fun initOnCreated(intent: Intent) {
pageType.value = DetailsPageType.valueOf(
intent.getStringExtra(Constant.Key.PAGE_TYPE) ?: DetailsPageType.Modify.name
)
mawbId = intent.getStringExtra(Constant.Key.ID) ?: ""
loadData()
}
private fun loadData() {
launchLoadingCollect({
NetApply.api.getGnjMoveStashDetail(mawbId)
}) {
onSuccess = {
val bean = it.data ?: GnjYiKuBean()
dataBean.value = bean
// 处理图片列表
val images = bean.getImageList().map { url ->
FileBean(path = url)
}.toMutableList()
// 编辑模式添加空 FileBean 用于显示"添加照片"按钮
if (pageType.value == DetailsPageType.Modify) {
images.add(FileBean())
}
imageList.value = images
// 详情模式下无图片时显示占位提示
if (pageType.value == DetailsPageType.Details && bean.getImageList().isEmpty()) {
showNoImage.value = true
}
}
}
}
/**
* 提交保存(只保存备注和图片)
*/
fun submit() {
val bean = dataBean.value ?: return
// 获取所有非空图片
val images = imageList.value!!.filter { it.path.isNotEmpty() }
if (images.size > 7) {
showToast("最多上传7张图片")
return
}
launchLoadingCollect({
// 上传图片
val uploadedUrls = mutableListOf<String>()
images.forEach { fileBean ->
if (fileBean.path.startsWith("http")) {
uploadedUrls.add(fileBean.path)
} else {
val result = UploadUtil.upload(fileBean.path)
if (result.verifySuccess()) {
uploadedUrls.add(result.data?.newName ?: "")
}
}
}
// 提交(只更新备注和图片)
val params = mapOf(
"mawbId" to mawbId,
"remark" to bean.remark,
"originalPic" to uploadedUrls.joinToString(","),
).toRequestBody(removeEmptyOrNull = true)
NetApply.api.modifyGnjMoveStash(params)
}) {
onSuccess = {
showToast("保存成功")
viewModelScope.launch {
FlowBus.with<String>(ConstantEvent.EVENT_REFRESH_GNJ_YIKU_LIST).emit("refresh")
}
getTopActivity().finish()
}
}
}
/**
* 处理图片删除点击事件
*/
override fun onItemClick(position: Int, type: Int) {
val list = imageList.value!!
if (type == R.id.iv_delete && position < list.size) {
list.removeAt(position)
imageList.value = list
}
}
}

View File

@@ -2,6 +2,7 @@ package com.lukouguoji.gnj.page.yiku.list
import android.view.View
import com.lukouguoji.gnj.databinding.ItemGnjYikuListBinding
import com.lukouguoji.gnj.page.yiku.handover.GnjYiKuHandoverActivity
import com.lukouguoji.module_base.base.BaseViewHolder
import com.lukouguoji.module_base.bean.GnjYiKuBean
@@ -19,5 +20,16 @@ class GnjYiKuListViewHolder(view: View) :
binding.ivIcon.setOnClickListener {
bean.checked.set(!bean.checked.get())
}
// 点击列表项进入移交详情
binding.ll.setOnClickListener {
GnjYiKuHandoverActivity.startForDetails(itemView.context, bean.id)
}
// 侧滑菜单 - 编辑按钮
binding.btnEdit.setOnClickListener {
binding.swipeMenu.quickClose()
GnjYiKuHandoverActivity.startForEdit(itemView.context, bean.id)
}
}
}

View File

@@ -0,0 +1,268 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<data>
<import type="com.lukouguoji.module_base.ui.weight.data.layout.DataLayoutType" />
<import type="com.lukouguoji.module_base.common.DetailsPageType" />
<import type="android.view.View" />
<variable
name="viewModel"
type="com.lukouguoji.gnj.page.yiku.handover.GnjYiKuHandoverViewModel" />
</data>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/color_f2"
android:orientation="vertical">
<include layout="@layout/title_tool_bar" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="15dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_white_radius_8"
android:orientation="vertical"
android:padding="15dp">
<!-- 第一行:运单号、件数、重量(均只读) -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
enable="@{false}"
title='@{"运单号"}'
titleLength="@{5}"
type="@{DataLayoutType.INPUT}"
value='@{viewModel.dataBean.wbNo}' />
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
enable="@{false}"
title='@{"件数"}'
titleLength="@{5}"
type="@{DataLayoutType.INPUT}"
value='@{viewModel.dataBean.pc}' />
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
enable="@{false}"
title='@{"重量"}'
titleLength="@{5}"
type="@{DataLayoutType.INPUT}"
value='@{viewModel.dataBean.weight}' />
</LinearLayout>
<!-- 第二行:特码、代理、品名(均只读) -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:orientation="horizontal">
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
enable="@{false}"
title='@{"特码"}'
titleLength="@{5}"
type="@{DataLayoutType.INPUT}"
value='@{viewModel.dataBean.spCode}' />
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
enable="@{false}"
title='@{"代理"}'
titleLength="@{5}"
type="@{DataLayoutType.INPUT}"
value='@{viewModel.dataBean.agentCode}' />
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
enable="@{false}"
title='@{"品名"}'
titleLength="@{5}"
type="@{DataLayoutType.INPUT}"
value='@{viewModel.dataBean.goods}' />
</LinearLayout>
<!-- 第三行:进港航班、航程、运单类型(均只读) -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:orientation="horizontal">
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
enable="@{false}"
title='@{"进港航班"}'
titleLength="@{5}"
type="@{DataLayoutType.INPUT}"
value='@{viewModel.dataBean.flight}' />
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
enable="@{false}"
title='@{"航程"}'
titleLength="@{5}"
type="@{DataLayoutType.INPUT}"
value='@{viewModel.dataBean.routeDisplay}' />
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
enable="@{false}"
title='@{"运单类型"}'
titleLength="@{5}"
type="@{DataLayoutType.INPUT}"
value='@{viewModel.dataBean.awbType}' />
</LinearLayout>
<!-- 第四行:电报号(只读)、备注(编辑模式可编辑) -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:orientation="horizontal">
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
enable="@{false}"
title='@{"电报号"}'
titleLength="@{5}"
type="@{DataLayoutType.INPUT}"
value='@{viewModel.dataBean.telegramDisplay}' />
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="2"
enable="@{viewModel.pageType != DetailsPageType.Details}"
hint='@{"请输入备注"}'
title='@{"备注"}'
titleLength="@{5}"
type="@{DataLayoutType.INPUT}"
value='@={viewModel.dataBean.remark}' />
</LinearLayout>
</LinearLayout>
<!-- 交接图片区域 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:background="@drawable/bg_white_radius_8"
android:orientation="vertical"
android:padding="15dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="交接图片"
android:textColor="@color/text_normal"
android:textSize="16sp"
android:textStyle="bold" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_images"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:overScrollMode="never"
itemLayoutId="@{viewModel.imageItemLayoutId}"
viewHolder="@{viewModel.imageItemViewHolder}"
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
app:spanCount="6" />
<!-- 详情模式下无图片时的占位提示 -->
<TextView
android:id="@+id/tv_no_image"
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_marginTop="10dp"
android:background="@color/white"
android:gravity="center"
android:text="暂无图片"
android:textColor="@color/text_gray"
android:textSize="14sp"
android:visibility="@{viewModel.showNoImage ? View.VISIBLE : View.GONE}" />
</LinearLayout>
</LinearLayout>
</ScrollView>
<!-- 底部按钮(详情模式不显示) -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="60dp"
android:background="@color/white"
android:gravity="center"
android:orientation="horizontal"
android:visibility="@{viewModel.pageType != DetailsPageType.Details ? View.VISIBLE : View.GONE}">
<TextView
android:layout_width="150dp"
android:layout_height="50dp"
android:layout_marginRight="20dp"
android:background="@drawable/bg_gray_radius_4"
android:gravity="center"
android:onClick="@{()-> viewModel.getTopActivity().finish()}"
android:text="取消"
android:textColor="@color/white"
android:textSize="18sp" />
<TextView
style="@style/tv_bottom_btn_lg"
android:onClick="@{()-> viewModel.submit()}"
android:text="保存" />
</LinearLayout>
</LinearLayout>
</layout>

View File

@@ -10,12 +10,25 @@
type="com.lukouguoji.module_base.bean.GnjYiKuBean" />
</data>
<androidx.appcompat.widget.LinearLayoutCompat
android:id="@+id/ll"
<!-- 外层容器承载间距 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="15dp"
android:layout_marginVertical="5dp"
android:orientation="vertical">
<!-- 侧滑布局 -->
<com.mcxtzhang.swipemenulib.SwipeMenuLayout
android:id="@+id/swipe_menu"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!-- 主列表项容器 -->
<androidx.appcompat.widget.LinearLayoutCompat
android:id="@+id/ll"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_item"
android:orientation="horizontal"
android:padding="10dp">
@@ -30,9 +43,10 @@
android:src="@drawable/img_plane" />
<LinearLayout
android:layout_width="match_parent"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_weight="1"
android:orientation="vertical">
<!-- 第一行数据 -->
@@ -264,4 +278,24 @@
</LinearLayout>
</androidx.appcompat.widget.LinearLayoutCompat>
<!-- 侧滑菜单区域 -->
<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="编辑" />
</androidx.appcompat.widget.LinearLayoutCompat>
</com.mcxtzhang.swipemenulib.SwipeMenuLayout>
</LinearLayout>
</layout>