fix: 图片控件优化及多处字段修正
- 图片选择控件:加号按钮灰色背景、label 样式统一、图片区域并入表单卡片 - 国内进港移交:修复图片上传未提交 bug,从 adapter 实时获取图片列表 - 国内进港移库列表:添加右侧箭头,已出库禁止编辑 - 国际事故签证列表:修正 Bean 字段名匹配 API(dep/dest/pc/weight/dpc) - 国际进港舱单:实到件数、计费重量、品名(中) 设为必填 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package com.lukouguoji.aerologic.page.gnj.move.stash.list
|
package com.lukouguoji.aerologic.page.gnj.move.stash.list
|
||||||
|
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
import android.widget.Toast
|
||||||
import com.lukouguoji.aerologic.databinding.ItemGnjMoveStashListBinding
|
import com.lukouguoji.aerologic.databinding.ItemGnjMoveStashListBinding
|
||||||
import com.lukouguoji.gnj.page.yiku.handover.GnjYiKuHandoverActivity
|
import com.lukouguoji.gnj.page.yiku.handover.GnjYiKuHandoverActivity
|
||||||
import com.lukouguoji.module_base.base.BaseViewHolder
|
import com.lukouguoji.module_base.base.BaseViewHolder
|
||||||
@@ -25,6 +26,10 @@ class GnjMoveStashListViewHolder(view: View) :
|
|||||||
// 侧滑菜单 - 编辑按钮
|
// 侧滑菜单 - 编辑按钮
|
||||||
binding.btnEdit.setOnClickListener {
|
binding.btnEdit.setOnClickListener {
|
||||||
binding.swipeMenu.quickClose()
|
binding.swipeMenu.quickClose()
|
||||||
|
if (bean.pickFlag == "1") {
|
||||||
|
Toast.makeText(itemView.context, "已出库,不可编辑", Toast.LENGTH_SHORT).show()
|
||||||
|
return@setOnClickListener
|
||||||
|
}
|
||||||
GnjYiKuHandoverActivity.startForEdit(itemView.context, bean.mawbId)
|
GnjYiKuHandoverActivity.startForEdit(itemView.context, bean.mawbId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,7 +76,7 @@
|
|||||||
<androidx.appcompat.widget.LinearLayoutCompat
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
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="0.8"
|
||||||
android:gravity="center_vertical">
|
android:gravity="center_vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@@ -95,7 +95,7 @@
|
|||||||
<androidx.appcompat.widget.LinearLayoutCompat
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
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="0.7"
|
||||||
android:gravity="center_vertical">
|
android:gravity="center_vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@@ -114,7 +114,7 @@
|
|||||||
<androidx.appcompat.widget.LinearLayoutCompat
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
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="0.8"
|
||||||
android:gravity="center_vertical">
|
android:gravity="center_vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@@ -178,7 +178,7 @@
|
|||||||
<androidx.appcompat.widget.LinearLayoutCompat
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
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="0.8"
|
||||||
android:gravity="center_vertical">
|
android:gravity="center_vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@@ -197,7 +197,7 @@
|
|||||||
<androidx.appcompat.widget.LinearLayoutCompat
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
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="0.8"
|
||||||
android:gravity="center_vertical">
|
android:gravity="center_vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@@ -216,7 +216,7 @@
|
|||||||
<androidx.appcompat.widget.LinearLayoutCompat
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
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="0.8"
|
||||||
android:gravity="center_vertical">
|
android:gravity="center_vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@@ -255,6 +255,14 @@
|
|||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<!-- 右侧箭头 -->
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="30dp"
|
||||||
|
android:layout_height="30dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginLeft="10dp"
|
||||||
|
android:src="@drawable/img_pda_right" />
|
||||||
|
|
||||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
|
|
||||||
<!-- 侧滑菜单区域 -->
|
<!-- 侧滑菜单区域 -->
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ class GnjYiKuBean : ICheck {
|
|||||||
var businessType: String = "" // 业务类型
|
var businessType: String = "" // 业务类型
|
||||||
var opDate: String = "" // 操作日期
|
var opDate: String = "" // 操作日期
|
||||||
var carrier: String = "" // 承运人
|
var carrier: String = "" // 承运人
|
||||||
|
var pickFlag: String = "" // 出库标志(1=已出库)
|
||||||
|
|
||||||
// 多选状态绑定
|
// 多选状态绑定
|
||||||
val checked = ObservableBoolean(false)
|
val checked = ObservableBoolean(false)
|
||||||
|
|||||||
@@ -6,12 +6,12 @@ class IntImpAccidentVisaBean {
|
|||||||
var id: Long = 0
|
var id: Long = 0
|
||||||
var fdate: String = "" // 航班日期
|
var fdate: String = "" // 航班日期
|
||||||
var fno: String = "" // 航班号
|
var fno: String = "" // 航班号
|
||||||
var fdep: String = "" // 始发站
|
var dep: String = "" // 始发站
|
||||||
var fdest: String = "" // 目的站
|
var dest: String = "" // 目的站
|
||||||
var wbNo: String = "" // 运单号
|
var wbNo: String = "" // 运单号
|
||||||
var totalPc: Int = 0 // 运单总件数
|
var pc: Int = 0 // 运单总件数
|
||||||
var totalWeight: Double = 0.0 // 运单总重量
|
var weight: Double = 0.0 // 运单总重量
|
||||||
var abnPc: Int = 0 // 不正常件数
|
var dpc: Int = 0 // 不正常件数
|
||||||
var opId: String = "" // 经办人
|
var opId: String = "" // 经办人
|
||||||
var opdate: String = "" // 经办时间
|
var opdate: String = "" // 经办时间
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:layout_margin="5dp"
|
android:layout_margin="5dp"
|
||||||
android:background="@color/white">
|
android:background="@{bean.path.length() == 0 ? @color/color_f2 : @color/white}">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
visible="@{bean.path.length() == 0}"
|
visible="@{bean.path.length() == 0}"
|
||||||
|
|||||||
@@ -324,7 +324,10 @@ class GjjManifestAddViewModel : BaseViewModel() {
|
|||||||
|| verifyWaybillNo(waybillNo.value)
|
|| verifyWaybillNo(waybillNo.value)
|
||||||
|| agent.value.verifyNullOrEmpty("请选择代理")
|
|| agent.value.verifyNullOrEmpty("请选择代理")
|
||||||
|| waybillNum.value.verifyNullOrEmpty("请输入运单件数")
|
|| waybillNum.value.verifyNullOrEmpty("请输入运单件数")
|
||||||
|
|| actualNum.value.verifyNullOrEmpty("请输入实到件数")
|
||||||
|| actualWeight.value.verifyNullOrEmpty("请输入实到重量")
|
|| actualWeight.value.verifyNullOrEmpty("请输入实到重量")
|
||||||
|
|| billingWeight.value.verifyNullOrEmpty("请输入计费重量")
|
||||||
|
|| goodsNameCn.value.verifyNullOrEmpty("请输入品名(中)")
|
||||||
|| goodsNameEn.value.verifyNullOrEmpty("请输入品名(英)")
|
|| goodsNameEn.value.verifyNullOrEmpty("请输入品名(英)")
|
||||||
|| waybillType.value.verifyNullOrEmpty("请选择运单类型")
|
|| waybillType.value.verifyNullOrEmpty("请选择运单类型")
|
||||||
|| businessType.value.verifyNullOrEmpty("请选择业务类型")
|
|| businessType.value.verifyNullOrEmpty("请选择业务类型")
|
||||||
|
|||||||
@@ -207,7 +207,7 @@
|
|||||||
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
||||||
android:id="@+id/actualNumInput"
|
android:id="@+id/actualNumInput"
|
||||||
hint='@{"请输入实到件数"}'
|
hint='@{"请输入实到件数"}'
|
||||||
required="@{false}"
|
required="@{true}"
|
||||||
title='@{"实到件数"}'
|
title='@{"实到件数"}'
|
||||||
titleLength="@{5}"
|
titleLength="@{5}"
|
||||||
type="@{DataLayoutType.INPUT}"
|
type="@{DataLayoutType.INPUT}"
|
||||||
@@ -242,7 +242,7 @@
|
|||||||
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
||||||
android:id="@+id/billingWeightInput"
|
android:id="@+id/billingWeightInput"
|
||||||
hint='@{"请输入计费重量"}'
|
hint='@{"请输入计费重量"}'
|
||||||
required="@{false}"
|
required="@{true}"
|
||||||
title='@{"计费重量"}'
|
title='@{"计费重量"}'
|
||||||
titleLength="@{5}"
|
titleLength="@{5}"
|
||||||
type="@{DataLayoutType.INPUT}"
|
type="@{DataLayoutType.INPUT}"
|
||||||
@@ -253,7 +253,7 @@
|
|||||||
|
|
||||||
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
||||||
hint='@{"请输入品名(中)"}'
|
hint='@{"请输入品名(中)"}'
|
||||||
required="@{false}"
|
required="@{true}"
|
||||||
title='@{"品名(中)"}'
|
title='@{"品名(中)"}'
|
||||||
titleLength="@{5}"
|
titleLength="@{5}"
|
||||||
type="@{DataLayoutType.INPUT}"
|
type="@{DataLayoutType.INPUT}"
|
||||||
|
|||||||
@@ -318,43 +318,49 @@
|
|||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
<!-- 图片区域:label 在左,图片在右 -->
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="15dp"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<!-- 图像区域标题(详情模式无图片时隐藏) -->
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_image_title"
|
android:id="@+id/tv_image_title"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="15dp"
|
android:layout_gravity="center_vertical"
|
||||||
android:text='@{viewModel.isDetailMode ? "图片" : "上传图像"}'
|
android:text='@{viewModel.isDetailMode ? "图片" : "上传图像"}'
|
||||||
android:textColor="@color/text_normal"
|
android:textColor="@color/text_gray"
|
||||||
android:textSize="16sp"
|
completeSpace="@{5}" />
|
||||||
android:textStyle="bold" />
|
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/rv"
|
android:id="@+id/rv"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:overScrollMode="never"
|
||||||
itemLayoutId="@{viewModel.itemLayoutId}"
|
itemLayoutId="@{viewModel.itemLayoutId}"
|
||||||
viewHolder="@{viewModel.itemViewHolder}"
|
viewHolder="@{viewModel.itemViewHolder}"
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
|
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
|
||||||
app:spanCount="6"
|
app:spanCount="9"
|
||||||
tools:listitem="@layout/item_image_select_new" />
|
tools:listitem="@layout/item_image_select_new" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<!-- 详情模式下无图片时的占位提示 -->
|
<!-- 详情模式下无图片时的占位提示 -->
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_no_image"
|
android:id="@+id/tv_no_image"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="80dp"
|
android:layout_height="60dp"
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:background="@color/white"
|
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="暂无图片"
|
android:text="暂无图片"
|
||||||
android:textColor="@color/text_gray"
|
android:textColor="@color/text_gray"
|
||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
android:visibility="@{viewModel.showNoImage ? View.VISIBLE : View.GONE}" />
|
android:visibility="@{viewModel.showNoImage ? View.VISIBLE : View.GONE}" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<!-- 底部按钮(详情模式隐藏) -->
|
<!-- 底部按钮(详情模式隐藏) -->
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|||||||
@@ -85,7 +85,7 @@
|
|||||||
<androidx.appcompat.widget.LinearLayoutCompat
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="0.8"
|
android:layout_weight="0.7"
|
||||||
android:gravity="center_vertical">
|
android:gravity="center_vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@@ -98,7 +98,7 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@{bean.fdep}"
|
android:text="@{bean.dep}"
|
||||||
android:textSize="15sp" />
|
android:textSize="15sp" />
|
||||||
|
|
||||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
@@ -107,7 +107,7 @@
|
|||||||
<androidx.appcompat.widget.LinearLayoutCompat
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1.2"
|
android:layout_weight="0.8"
|
||||||
android:gravity="center_vertical">
|
android:gravity="center_vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@@ -120,7 +120,7 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@{String.valueOf(bean.totalPc)}"
|
android:text="@{String.valueOf(bean.pc)}"
|
||||||
android:textSize="15sp" />
|
android:textSize="15sp" />
|
||||||
|
|
||||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
@@ -142,7 +142,7 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@{String.valueOf(bean.abnPc)}"
|
android:text="@{String.valueOf(bean.dpc)}"
|
||||||
android:textSize="15sp" />
|
android:textSize="15sp" />
|
||||||
|
|
||||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
@@ -205,7 +205,7 @@
|
|||||||
<androidx.appcompat.widget.LinearLayoutCompat
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="0.8"
|
android:layout_weight="0.7"
|
||||||
android:gravity="center_vertical">
|
android:gravity="center_vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@@ -218,7 +218,7 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@{bean.fdest}"
|
android:text="@{bean.dest}"
|
||||||
android:textSize="15sp" />
|
android:textSize="15sp" />
|
||||||
|
|
||||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
@@ -227,7 +227,7 @@
|
|||||||
<androidx.appcompat.widget.LinearLayoutCompat
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1.2"
|
android:layout_weight="0.8"
|
||||||
android:gravity="center_vertical">
|
android:gravity="center_vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@@ -240,7 +240,7 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@{String.valueOf(bean.totalWeight)}"
|
android:text="@{String.valueOf(bean.weight)}"
|
||||||
android:textSize="15sp" />
|
android:textSize="15sp" />
|
||||||
|
|
||||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
|
|||||||
@@ -35,6 +35,9 @@ class GnjYiKuHandoverActivity :
|
|||||||
|
|
||||||
binding.viewModel = viewModel
|
binding.viewModel = viewModel
|
||||||
|
|
||||||
|
// 绑定图片 RecyclerView 引用
|
||||||
|
viewModel.rvImages = binding.rvImages
|
||||||
|
|
||||||
// 绑定图片列表点击事件(编辑模式下可删除图片)
|
// 绑定图片列表点击事件(编辑模式下可删除图片)
|
||||||
binding.rvImages.addOnItemClickListener(viewModel)
|
binding.rvImages.addOnItemClickListener(viewModel)
|
||||||
|
|
||||||
|
|||||||
@@ -14,9 +14,12 @@ import com.lukouguoji.module_base.http.net.NetApply
|
|||||||
import com.lukouguoji.module_base.impl.FlowBus
|
import com.lukouguoji.module_base.impl.FlowBus
|
||||||
import com.lukouguoji.module_base.impl.ImageSelectNewViewHolder
|
import com.lukouguoji.module_base.impl.ImageSelectNewViewHolder
|
||||||
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.launchLoadingCollect
|
import com.lukouguoji.module_base.ktx.launchLoadingCollect
|
||||||
import com.lukouguoji.module_base.ktx.showToast
|
import com.lukouguoji.module_base.ktx.showToast
|
||||||
import com.lukouguoji.module_base.ktx.toRequestBody
|
import com.lukouguoji.module_base.ktx.toRequestBody
|
||||||
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
import com.lukouguoji.module_base.util.MediaUtil
|
||||||
import com.lukouguoji.module_base.util.UploadUtil
|
import com.lukouguoji.module_base.util.UploadUtil
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
|
||||||
@@ -40,6 +43,9 @@ class GnjYiKuHandoverViewModel : BaseViewModel(), IOnItemClickListener {
|
|||||||
// 详情模式下无图片时显示占位提示
|
// 详情模式下无图片时显示占位提示
|
||||||
val showNoImage = MutableLiveData(false)
|
val showNoImage = MutableLiveData(false)
|
||||||
|
|
||||||
|
// 图片 RecyclerView 引用(用于从 adapter 实时获取图片)
|
||||||
|
var rvImages: RecyclerView? = null
|
||||||
|
|
||||||
fun initOnCreated(intent: Intent) {
|
fun initOnCreated(intent: Intent) {
|
||||||
pageType.value = DetailsPageType.valueOf(
|
pageType.value = DetailsPageType.valueOf(
|
||||||
intent.getStringExtra(Constant.Key.PAGE_TYPE) ?: DetailsPageType.Modify.name
|
intent.getStringExtra(Constant.Key.PAGE_TYPE) ?: DetailsPageType.Modify.name
|
||||||
@@ -56,9 +62,9 @@ class GnjYiKuHandoverViewModel : BaseViewModel(), IOnItemClickListener {
|
|||||||
val bean = it.data ?: GnjYiKuBean()
|
val bean = it.data ?: GnjYiKuBean()
|
||||||
dataBean.value = bean
|
dataBean.value = bean
|
||||||
|
|
||||||
// 处理图片列表
|
// 处理图片列表(拼接完整 URL)
|
||||||
val images = bean.getImageList().map { url ->
|
val images = bean.getImageList().map { url ->
|
||||||
FileBean(path = url)
|
FileBean(path = MediaUtil.fillUrl(url), url = url)
|
||||||
}.toMutableList()
|
}.toMutableList()
|
||||||
|
|
||||||
// 编辑模式添加空 FileBean 用于显示"添加照片"按钮
|
// 编辑模式添加空 FileBean 用于显示"添加照片"按钮
|
||||||
@@ -82,8 +88,10 @@ class GnjYiKuHandoverViewModel : BaseViewModel(), IOnItemClickListener {
|
|||||||
fun submit() {
|
fun submit() {
|
||||||
val bean = dataBean.value ?: return
|
val bean = dataBean.value ?: return
|
||||||
|
|
||||||
// 获取所有非空图片
|
// 从 adapter 实时获取所有非空图片(ViewHolder 新增图片直接操作 adapter items)
|
||||||
val images = imageList.value!!.filter { it.path.isNotEmpty() }
|
val allItems = (rvImages?.commonAdapter()?.items as? List<*>)
|
||||||
|
?.filterIsInstance<FileBean>() ?: imageList.value!!
|
||||||
|
val images = allItems.filter { it.path.isNotEmpty() }
|
||||||
|
|
||||||
if (images.size > 7) {
|
if (images.size > 7) {
|
||||||
showToast("最多上传7张图片")
|
showToast("最多上传7张图片")
|
||||||
@@ -94,8 +102,9 @@ class GnjYiKuHandoverViewModel : BaseViewModel(), IOnItemClickListener {
|
|||||||
// 上传图片
|
// 上传图片
|
||||||
val uploadedUrls = mutableListOf<String>()
|
val uploadedUrls = mutableListOf<String>()
|
||||||
images.forEach { fileBean ->
|
images.forEach { fileBean ->
|
||||||
if (fileBean.path.startsWith("http")) {
|
if (fileBean.url.isNotEmpty()) {
|
||||||
uploadedUrls.add(fileBean.path)
|
// 已上传的图片,直接用文件名
|
||||||
|
uploadedUrls.add(fileBean.url)
|
||||||
} else {
|
} else {
|
||||||
val result = UploadUtil.upload(fileBean.path)
|
val result = UploadUtil.upload(fileBean.path)
|
||||||
if (result.verifySuccess()) {
|
if (result.verifySuccess()) {
|
||||||
@@ -127,10 +136,11 @@ class GnjYiKuHandoverViewModel : BaseViewModel(), IOnItemClickListener {
|
|||||||
* 处理图片删除点击事件
|
* 处理图片删除点击事件
|
||||||
*/
|
*/
|
||||||
override fun onItemClick(position: Int, type: Int) {
|
override fun onItemClick(position: Int, type: Int) {
|
||||||
val list = imageList.value!!
|
if (type == R.id.iv_delete) {
|
||||||
if (type == R.id.iv_delete && position < list.size) {
|
val adapter = rvImages?.commonAdapter() ?: return
|
||||||
list.removeAt(position)
|
if (position < adapter.items.size) {
|
||||||
imageList.value = list
|
adapter.removeItem(position)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,8 +26,7 @@
|
|||||||
|
|
||||||
<ScrollView
|
<ScrollView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="1"
|
|
||||||
android:fillViewport="true">
|
android:fillViewport="true">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@@ -189,43 +188,39 @@
|
|||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
<!-- 交接图片区域:label 在左,图片在右 -->
|
||||||
|
|
||||||
<!-- 交接图片区域 -->
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="15dp"
|
android:layout_marginTop="15dp"
|
||||||
android:background="@drawable/bg_white_radius_8"
|
android:orientation="horizontal">
|
||||||
android:orientation="vertical"
|
|
||||||
android:padding="15dp">
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
android:text="交接图片"
|
android:text="交接图片"
|
||||||
android:textColor="@color/text_normal"
|
android:textColor="@color/text_gray"
|
||||||
android:textSize="16sp"
|
completeSpace="@{5}" />
|
||||||
android:textStyle="bold" />
|
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/rv_images"
|
android:id="@+id/rv_images"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_weight="1"
|
||||||
android:overScrollMode="never"
|
android:overScrollMode="never"
|
||||||
itemLayoutId="@{viewModel.imageItemLayoutId}"
|
itemLayoutId="@{viewModel.imageItemLayoutId}"
|
||||||
viewHolder="@{viewModel.imageItemViewHolder}"
|
viewHolder="@{viewModel.imageItemViewHolder}"
|
||||||
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
|
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
|
||||||
app:spanCount="6" />
|
app:spanCount="9" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<!-- 详情模式下无图片时的占位提示 -->
|
<!-- 详情模式下无图片时的占位提示 -->
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_no_image"
|
android:id="@+id/tv_no_image"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="80dp"
|
android:layout_height="60dp"
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:background="@color/white"
|
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="暂无图片"
|
android:text="暂无图片"
|
||||||
android:textColor="@color/text_gray"
|
android:textColor="@color/text_gray"
|
||||||
@@ -234,35 +229,32 @@
|
|||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
</ScrollView>
|
|
||||||
|
|
||||||
<!-- 底部按钮(详情模式不显示) -->
|
<!-- 底部按钮(详情模式不显示) -->
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="60dp"
|
android:layout_height="wrap_content"
|
||||||
android:background="@color/white"
|
android:layout_marginTop="24dp"
|
||||||
|
android:layout_marginBottom="15dp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:visibility="@{viewModel.pageType != DetailsPageType.Details ? View.VISIBLE : View.GONE}">
|
android:visibility="@{viewModel.pageType != DetailsPageType.Details ? View.VISIBLE : View.GONE}">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="150dp"
|
style="@style/tv_bottom_btn"
|
||||||
android:layout_height="50dp"
|
android:layout_width="120dp"
|
||||||
android:layout_marginRight="20dp"
|
|
||||||
android:background="@drawable/bg_gray_radius_4"
|
|
||||||
android:gravity="center"
|
|
||||||
android:onClick="@{()-> viewModel.getTopActivity().finish()}"
|
android:onClick="@{()-> viewModel.getTopActivity().finish()}"
|
||||||
android:text="取消"
|
android:text="取消" />
|
||||||
android:textColor="@color/white"
|
|
||||||
android:textSize="18sp" />
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
style="@style/tv_bottom_btn_lg"
|
style="@style/tv_bottom_btn"
|
||||||
|
android:layout_width="120dp"
|
||||||
android:onClick="@{()-> viewModel.submit()}"
|
android:onClick="@{()-> viewModel.submit()}"
|
||||||
android:text="保存" />
|
android:text="保存" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
</ScrollView>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</layout>
|
</layout>
|
||||||
|
|||||||
Reference in New Issue
Block a user