diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 8139ed8..98337de 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -432,6 +432,13 @@
android:exported="false"
android:screenOrientation="userLandscape" />
+
+
+
+ /**
+ * 国际进港舱单-分拣理货(装机单)-修改装机单
+ */
+ @POST("IntImpManifest/modifyManifestAir")
+ suspend fun modifyIntImpLoadingList(@Body data: RequestBody): BaseResultBean
+
/**
* 国际进港理货报告-分页查询
*/
diff --git a/module_gjj/src/main/java/com/lukouguoji/gjj/activity/IntImpLoadingListEditActivity.kt b/module_gjj/src/main/java/com/lukouguoji/gjj/activity/IntImpLoadingListEditActivity.kt
new file mode 100644
index 0000000..ebfec73
--- /dev/null
+++ b/module_gjj/src/main/java/com/lukouguoji/gjj/activity/IntImpLoadingListEditActivity.kt
@@ -0,0 +1,37 @@
+package com.lukouguoji.gjj.activity
+
+import android.content.Context
+import android.content.Intent
+import android.os.Bundle
+import com.google.gson.Gson
+import com.lukouguoji.gjj.R
+import com.lukouguoji.gjj.databinding.ActivityIntImpLoadingListEditBinding
+import com.lukouguoji.gjj.viewModel.IntImpLoadingListEditViewModel
+import com.lukouguoji.module_base.base.BaseBindingActivity
+import com.lukouguoji.module_base.bean.GjjManifest
+import com.lukouguoji.module_base.common.Constant
+
+/**
+ * 国际进港-装机单编辑页面
+ */
+class IntImpLoadingListEditActivity :
+ BaseBindingActivity() {
+
+ override fun layoutId() = R.layout.activity_int_imp_loading_list_edit
+ override fun viewModelClass() = IntImpLoadingListEditViewModel::class.java
+
+ override fun initOnCreate(savedInstanceState: Bundle?) {
+ setBackArrow("装机单编辑")
+ binding.viewModel = viewModel
+ viewModel.initOnCreated(intent)
+ }
+
+ companion object {
+ @JvmStatic
+ fun start(context: Context, bean: GjjManifest) {
+ val starter = Intent(context, IntImpLoadingListEditActivity::class.java)
+ .putExtra(Constant.Key.DATA, Gson().toJson(bean))
+ context.startActivity(starter)
+ }
+ }
+}
diff --git a/module_gjj/src/main/java/com/lukouguoji/gjj/holder/IntImpLoadingListViewHolder.kt b/module_gjj/src/main/java/com/lukouguoji/gjj/holder/IntImpLoadingListViewHolder.kt
index 42fb679..bfbdfc6 100644
--- a/module_gjj/src/main/java/com/lukouguoji/gjj/holder/IntImpLoadingListViewHolder.kt
+++ b/module_gjj/src/main/java/com/lukouguoji/gjj/holder/IntImpLoadingListViewHolder.kt
@@ -22,5 +22,11 @@ class IntImpLoadingListViewHolder(view: View) :
bean.checked.set(!bean.checked.get())
binding.executePendingBindings()
}
+
+ // 侧滑菜单 - 编辑按钮
+ binding.btnEdit.setOnClickListener {
+ binding.swipeMenu.quickClose()
+ clickListener?.onItemClick(position, 2000)
+ }
}
}
diff --git a/module_gjj/src/main/java/com/lukouguoji/gjj/viewModel/IntImpLoadingListEditViewModel.kt b/module_gjj/src/main/java/com/lukouguoji/gjj/viewModel/IntImpLoadingListEditViewModel.kt
new file mode 100644
index 0000000..6ba9f4e
--- /dev/null
+++ b/module_gjj/src/main/java/com/lukouguoji/gjj/viewModel/IntImpLoadingListEditViewModel.kt
@@ -0,0 +1,86 @@
+package com.lukouguoji.gjj.viewModel
+
+import android.content.Intent
+import androidx.lifecycle.MutableLiveData
+import androidx.lifecycle.viewModelScope
+import com.google.gson.Gson
+import com.lukouguoji.module_base.base.BaseViewModel
+import com.lukouguoji.module_base.bean.GjjManifest
+import com.lukouguoji.module_base.common.Constant
+import com.lukouguoji.module_base.common.ConstantEvent
+import com.lukouguoji.module_base.http.net.NetApply
+import com.lukouguoji.module_base.impl.FlowBus
+import com.lukouguoji.module_base.ktx.launchLoadingCollect
+import com.lukouguoji.module_base.ktx.showToast
+import com.lukouguoji.module_base.ktx.toRequestBody
+import kotlinx.coroutines.launch
+
+/**
+ * 国际进港装机单编辑 ViewModel
+ */
+class IntImpLoadingListEditViewModel : BaseViewModel() {
+
+ val dataBean = MutableLiveData(GjjManifest())
+
+ // 可编辑数值字段(String 用于双向绑定)
+ val location = MutableLiveData("")
+ val totalPcStr = MutableLiveData("")
+ val pcStr = MutableLiveData("")
+ val weightStr = MutableLiveData("")
+ val cashWeightStr = MutableLiveData("")
+
+ fun initOnCreated(intent: Intent) {
+ val jsonData = intent.getStringExtra(Constant.Key.DATA) ?: ""
+ if (jsonData.isNotEmpty()) {
+ try {
+ val bean = Gson().fromJson(jsonData, GjjManifest::class.java)
+ dataBean.value = bean
+ // 初始化可编辑字段
+ location.value = bean.location
+ totalPcStr.value = bean.totalPc.toString()
+ pcStr.value = bean.pc.toString()
+ weightStr.value = bean.weight.toString()
+ cashWeightStr.value = bean.cashWeight.toString()
+ } catch (e: Exception) {
+ showToast("数据解析失败")
+ getTopActivity().finish()
+ }
+ } else {
+ showToast("未接收到数据")
+ getTopActivity().finish()
+ }
+ }
+
+ /**
+ * 保存修改
+ */
+ fun submit() {
+ val bean = dataBean.value ?: return
+
+ // 同步可编辑字段回 bean
+ bean.location = location.value ?: ""
+ bean.totalPc = totalPcStr.value?.toLongOrNull() ?: 0
+ bean.pc = pcStr.value?.toLongOrNull() ?: 0
+ bean.weight = weightStr.value?.toDoubleOrNull() ?: 0.0
+ bean.cashWeight = cashWeightStr.value?.toDoubleOrNull() ?: 0.0
+
+ launchLoadingCollect({
+ NetApply.api.modifyIntImpLoadingList(bean.toRequestBody())
+ }) {
+ onSuccess = {
+ showToast("修改成功")
+ viewModelScope.launch {
+ FlowBus.with(ConstantEvent.EVENT_REFRESH).emit("refresh")
+ }
+ getTopActivity().finish()
+ }
+ }
+ }
+
+ /**
+ * 取消
+ */
+ fun cancel() {
+ getTopActivity().finish()
+ }
+}
diff --git a/module_gjj/src/main/java/com/lukouguoji/gjj/viewModel/IntImpLoadingListViewModel.kt b/module_gjj/src/main/java/com/lukouguoji/gjj/viewModel/IntImpLoadingListViewModel.kt
index 87b85ac..5269b87 100644
--- a/module_gjj/src/main/java/com/lukouguoji/gjj/viewModel/IntImpLoadingListViewModel.kt
+++ b/module_gjj/src/main/java/com/lukouguoji/gjj/viewModel/IntImpLoadingListViewModel.kt
@@ -10,6 +10,7 @@ import com.lukouguoji.module_base.common.Constant
import com.lukouguoji.module_base.common.ConstantEvent
import com.lukouguoji.module_base.http.net.NetApply
import com.lukouguoji.module_base.impl.FlowBus
+import com.lukouguoji.module_base.interfaces.IOnItemClickListener
import com.lukouguoji.module_base.ktx.commonAdapter
import com.lukouguoji.module_base.ktx.launchCollect
import com.lukouguoji.module_base.ktx.launchLoadingCollect
@@ -23,7 +24,7 @@ import kotlinx.coroutines.launch
/**
* 国际进港装机单 ViewModel
*/
-class IntImpLoadingListViewModel : BasePageViewModel() {
+class IntImpLoadingListViewModel : BasePageViewModel(), IOnItemClickListener {
// ========== 搜索条件 ==========
val flightDate = MutableLiveData("") // 航班日期
@@ -278,6 +279,20 @@ class IntImpLoadingListViewModel : BasePageViewModel() {
}
}
+ /**
+ * 列表项点击回调(侧滑菜单)
+ */
+ override fun onItemClick(position: Int, type: Int) {
+ when (type) {
+ 2000 -> {
+ // 编辑操作
+ val list = pageModel.rv?.commonAdapter()?.items as? List ?: return
+ val bean = list.getOrNull(position) ?: return
+ com.lukouguoji.gjj.activity.IntImpLoadingListEditActivity.start(getTopActivity(), bean)
+ }
+ }
+ }
+
/**
* 获取数据(重写BasePageViewModel)
* 查询参数与父页面(国际进港舱单)保持一致:使用FID和FDGP
diff --git a/module_gjj/src/main/res/layout/activity_int_imp_loading_list_edit.xml b/module_gjj/src/main/res/layout/activity_int_imp_loading_list_edit.xml
new file mode 100644
index 0000000..7eb4d01
--- /dev/null
+++ b/module_gjj/src/main/res/layout/activity_int_imp_loading_list_edit.xml
@@ -0,0 +1,216 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/module_gjj/src/main/res/layout/item_int_imp_loading_list.xml b/module_gjj/src/main/res/layout/item_int_imp_loading_list.xml
index e616f75..5cb31a8 100644
--- a/module_gjj/src/main/res/layout/item_int_imp_loading_list.xml
+++ b/module_gjj/src/main/res/layout/item_int_imp_loading_list.xml
@@ -15,297 +15,305 @@
type="Integer" />
-
+ android:layout_marginBottom="10dp">
-
-
-
-
+
+ android:background="@drawable/bg_white_radius_8"
+ android:orientation="horizontal"
+ android:padding="15dp"
+ android:gravity="center_vertical">
-
+
+
+
+
+ android:layout_marginLeft="15dp"
+ android:layout_weight="1"
+ android:orientation="vertical">
-
+
-
+
+ android:layout_weight="1.5"
+ android:gravity="center_vertical"
+ android:orientation="horizontal">
-
+
+
+
+
+
+
+
+ android:layout_weight="1"
+ android:gravity="center_vertical"
+ android:orientation="horizontal">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
+ android:layout_weight="1.5"
+ android:gravity="center_vertical"
+ android:orientation="horizontal">
-
+
+
+
+
+
+
+
+ android:layout_weight="1"
+ android:gravity="center_vertical"
+ android:orientation="horizontal">
-
+
-
-
+
-
+
+
+
+ android:layout_weight="1.5"
+ android:gravity="center_vertical"
+ android:orientation="horizontal">
-
+
+
+
+
+
+
+
+ android:layout_weight="1"
+ android:gravity="center_vertical"
+ android:orientation="horizontal">
-
+
-
-
+
-
+
+
+
+ android:layout_weight="1"
+ android:gravity="center_vertical"
+ android:orientation="horizontal">
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -313,6 +321,21 @@
-
+
+
+
+
+
+
+
+
+
diff --git a/module_gjj/src/main/res/layout/item_int_imp_manifest.xml b/module_gjj/src/main/res/layout/item_int_imp_manifest.xml
index 297edcf..190e5d8 100644
--- a/module_gjj/src/main/res/layout/item_int_imp_manifest.xml
+++ b/module_gjj/src/main/res/layout/item_int_imp_manifest.xml
@@ -22,16 +22,18 @@
android:layout_marginBottom="10dp"
android:orientation="vertical">
-
-
+
+ android:layout_height="wrap_content">
-
+
+ android:layout_height="wrap_content"
+ android:background="@drawable/bg_white_radius_8"
+ android:orientation="vertical">
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+ android:layout_marginLeft="10dp"
+ android:layout_weight="1"
+ android:orientation="vertical">
-
+
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
-
+
+ android:layout_weight="1.0"
+ android:gravity="center_vertical">
-
+
+
+
+
+
+
+
+ android:layout_weight="0.8"
+ android:gravity="center_vertical">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+ android:layout_marginTop="10dp">
-
+
+ android:layout_weight="1.0"
+ android:gravity="center_vertical">
-
+
+
+
+
+
+
+
+ android:layout_weight="0.8"
+ android:gravity="center_vertical">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
+
+ android:id="@+id/iv_show"
+ android:layout_width="match_parent"
+ android:layout_height="20dp"
+ android:layout_marginTop="5dp"
+ android:layout_marginBottom="5dp"
+ android:padding="5dp"
+ android:src="@mipmap/img_down" />
-
+
-
-
-
-
-
-
+