feat: 国际出港查询详情 tab 仓库信息
This commit is contained in:
@@ -31,7 +31,8 @@
|
||||
"Bash(git -C /Users/kid/Development/Fusion/Projects/aerologic-app branch -a)",
|
||||
"Bash(adb:*)",
|
||||
"Bash(emulator:*)",
|
||||
"Bash(logcat:*)"
|
||||
"Bash(logcat:*)",
|
||||
"Bash(grep:*)"
|
||||
],
|
||||
"deny": [],
|
||||
"ask": []
|
||||
|
||||
@@ -6,17 +6,23 @@ import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.databinding.DataBindingUtil
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.lukouguoji.gjc.R
|
||||
import com.lukouguoji.gjc.databinding.FragmentGjcQueryWarehouseBinding
|
||||
import com.lukouguoji.gjc.holder.GjcQueryWarehouseViewHolder
|
||||
import com.lukouguoji.gjc.viewModel.GjcQueryDetailsViewModel
|
||||
import com.lukouguoji.module_base.base.CommonAdapter
|
||||
import com.lukouguoji.module_base.bean.GjcWarehouse
|
||||
import com.lukouguoji.module_base.http.net.NetApply
|
||||
|
||||
/**
|
||||
* 国际出港查询详情 - 仓库信息Fragment (空实现)
|
||||
* 国际出港查询详情 - 仓库信息Fragment
|
||||
*/
|
||||
class GjcQueryWarehouseFragment : Fragment() {
|
||||
|
||||
private lateinit var binding: FragmentGjcQueryWarehouseBinding
|
||||
private lateinit var viewModel: GjcQueryDetailsViewModel
|
||||
private lateinit var adapter: CommonAdapter
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
@@ -30,9 +36,58 @@ class GjcQueryWarehouseFragment : Fragment() {
|
||||
false
|
||||
)
|
||||
binding.lifecycleOwner = viewLifecycleOwner
|
||||
|
||||
initRecyclerView()
|
||||
observeData()
|
||||
|
||||
return binding.root
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化RecyclerView
|
||||
*/
|
||||
private fun initRecyclerView() {
|
||||
adapter = CommonAdapter(
|
||||
requireContext(),
|
||||
R.layout.item_gjc_query_warehouse,
|
||||
GjcQueryWarehouseViewHolder::class.java
|
||||
)
|
||||
|
||||
binding.rvWarehouseList.apply {
|
||||
layoutManager = LinearLayoutManager(requireContext())
|
||||
adapter = this@GjcQueryWarehouseFragment.adapter
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 观察数据变化
|
||||
*/
|
||||
private fun observeData() {
|
||||
viewModel.warehouseList.observe(viewLifecycleOwner) { mapList ->
|
||||
if (mapList.isEmpty()) {
|
||||
// 显示空数据提示
|
||||
binding.rvWarehouseList.visibility = View.GONE
|
||||
binding.llEmpty.visibility = View.VISIBLE
|
||||
} else {
|
||||
// Map → GjcWarehouse Bean 转换
|
||||
val beanList = mapList.map { map ->
|
||||
try {
|
||||
val json = NetApply.gson.toJson(map)
|
||||
NetApply.gson.fromJson(json, GjcWarehouse::class.java)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
GjcWarehouse() // 转换失败返回空对象
|
||||
}
|
||||
}
|
||||
|
||||
// 更新RecyclerView
|
||||
binding.rvWarehouseList.visibility = View.VISIBLE
|
||||
binding.llEmpty.visibility = View.GONE
|
||||
adapter.refresh(beanList)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun newInstance(vm: GjcQueryDetailsViewModel) =
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.lukouguoji.gjc.holder
|
||||
|
||||
import android.view.View
|
||||
import com.lukouguoji.gjc.databinding.ItemGjcQueryWarehouseBinding
|
||||
import com.lukouguoji.module_base.base.BaseViewHolder
|
||||
import com.lukouguoji.module_base.bean.GjcWarehouse
|
||||
|
||||
/**
|
||||
* 国际出港查询详情-仓库信息ViewHolder
|
||||
*/
|
||||
class GjcQueryWarehouseViewHolder(view: View) :
|
||||
BaseViewHolder<GjcWarehouse, ItemGjcQueryWarehouseBinding>(view) {
|
||||
|
||||
override fun onBind(item: Any?, position: Int) {
|
||||
val bean = getItemBean(item) ?: return
|
||||
binding.bean = bean
|
||||
binding.position = position // 用于显示序号和背景切换
|
||||
binding.executePendingBindings()
|
||||
}
|
||||
}
|
||||
@@ -110,7 +110,8 @@
|
||||
<com.google.android.material.divider.MaterialDivider
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginHorizontal="15dp"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginEnd="23dp"
|
||||
android:background="@color/color_f2" />
|
||||
|
||||
<!-- ViewPager2 -->
|
||||
|
||||
@@ -1,19 +1,146 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<data>
|
||||
|
||||
<import type="android.view.View" />
|
||||
</data>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/color_f2"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
android:orientation="vertical"
|
||||
android:paddingHorizontal="15dp"
|
||||
android:paddingBottom="15dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/bg_white_radius_bottom_8"
|
||||
android:orientation="vertical"
|
||||
android:paddingEnd="8dp">
|
||||
|
||||
<!-- 表头 (深绿色背景) -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:background="@color/color_f2"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:paddingHorizontal="10dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.5"
|
||||
android:gravity="center"
|
||||
android:text="序号"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1.2"
|
||||
android:gravity="center"
|
||||
android:text="集装器"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.8"
|
||||
android:gravity="center"
|
||||
android:text="件数"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.8"
|
||||
android:gravity="center"
|
||||
android:text="重量(KG)"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:text="航班日期"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:text="航班号"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.8"
|
||||
android:gravity="center"
|
||||
android:text="航程"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.8"
|
||||
android:gravity="center"
|
||||
android:text="分批"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 数据列表 -->
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_warehouse_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:nestedScrollingEnabled="true"
|
||||
android:overScrollMode="never"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
|
||||
|
||||
<!-- 暂无数据提示 (数据为空时显示) -->
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_empty"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="暂无数据"
|
||||
android:textColor="@color/text_gray"
|
||||
android:textSize="16sp" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="暂无数据"
|
||||
android:textColor="@color/text_gray"
|
||||
android:textSize="16sp" />
|
||||
|
||||
</LinearLayout>
|
||||
</layout>
|
||||
|
||||
106
module_gjc/src/main/res/layout/item_gjc_query_warehouse.xml
Normal file
106
module_gjc/src/main/res/layout/item_gjc_query_warehouse.xml
Normal file
@@ -0,0 +1,106 @@
|
||||
<?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.GjcWarehouse" />
|
||||
|
||||
<variable
|
||||
name="position"
|
||||
type="Integer" />
|
||||
</data>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@{position % 2 == 0 ? @color/white : @color/color_f2}"
|
||||
android:gravity="center_vertical"
|
||||
android:minHeight="40dp"
|
||||
android:orientation="horizontal"
|
||||
android:paddingHorizontal="10dp"
|
||||
android:paddingVertical="8dp">
|
||||
|
||||
<!-- 序号 -->
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.5"
|
||||
android:gravity="center"
|
||||
android:text="@{String.valueOf(position + 1)}"
|
||||
android:textColor="@android:color/black"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<!-- 集装器 -->
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1.2"
|
||||
android:gravity="center"
|
||||
android:text="@{bean.location}"
|
||||
android:textColor="@android:color/black"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<!-- 件数 -->
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.8"
|
||||
android:gravity="center"
|
||||
android:text="@{String.valueOf(bean.pc)}"
|
||||
android:textColor="@android:color/black"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<!-- 重量 -->
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.8"
|
||||
android:gravity="center"
|
||||
android:text="@{String.valueOf(bean.weight)}"
|
||||
android:textColor="@android:color/black"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<!-- 航班日期 -->
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:text="@{bean.fdate}"
|
||||
android:textColor="@android:color/black"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<!-- 航班号 -->
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:text="@{bean.fno}"
|
||||
android:textColor="@android:color/black"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<!-- 航程 -->
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.8"
|
||||
android:gravity="center"
|
||||
android:text="@{bean.range}"
|
||||
android:textColor="@android:color/black"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<!-- 分批 -->
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.8"
|
||||
android:gravity="center"
|
||||
android:text="@{`1`}"
|
||||
android:textColor="@android:color/black"
|
||||
android:textSize="14sp" />
|
||||
|
||||
</LinearLayout>
|
||||
</layout>
|
||||
Reference in New Issue
Block a user