feat: ui opt

This commit is contained in:
2025-11-26 19:39:05 +08:00
parent ec9818e267
commit 83ccad4171
13 changed files with 697 additions and 4 deletions

View File

@@ -0,0 +1,188 @@
<?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">
<data>
<import type="android.view.View" />
<import type="com.lukouguoji.module_base.ui.weight.data.layout.DataLayoutType" />
<variable
name="viewModel"
type="com.lukouguoji.gjc.viewModel.GjcWeighingRecordDetailsViewModel" />
</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" />
<!-- 第一部分:运单信息区域 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="15dp"
android:background="@drawable/bg_white_radius_8"
android:orientation="horizontal"
android:padding="15dp">
<!-- 运单号(只读) -->
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
enable="@{false}"
hint='@{``}'
title='@{`运单号:`}'
titleLength="@{5}"
type="@{DataLayoutType.INPUT}"
value='@{viewModel.waybillNo}' />
<!-- 预配件数(只读) -->
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_weight="1"
enable="@{false}"
hint='@{``}'
title='@{`预配件数:`}'
titleLength="@{5}"
type="@{DataLayoutType.INPUT}"
value='@{viewModel.prePc}' />
<!-- 预配重量(只读) -->
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_weight="1"
enable="@{false}"
hint='@{``}'
title='@{`预配重量:`}'
titleLength="@{5}"
type="@{DataLayoutType.INPUT}"
value='@{viewModel.preWeight}' />
<!-- 品名(只读) -->
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_weight="1"
enable="@{false}"
hint='@{``}'
title='@{`品名:`}'
titleLength="@{3}"
type="@{DataLayoutType.INPUT}"
value='@{viewModel.goodsName}' />
</LinearLayout>
<!-- 第二部分:计重记录列表 -->
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:paddingStart="15dp"
android:paddingEnd="15dp" />
<!-- 第三部分:底部统计与按钮区域 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_white_radius_8"
android:layout_margin="15dp"
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}"
hint='@{``}'
title='@{`总件数:`}'
titleLength="@{4}"
type="@{DataLayoutType.INPUT}"
value='@{viewModel.totalPc}' />
<!-- 总重量(只读) -->
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_weight="1"
enable="@{false}"
hint='@{``}'
title='@{`总重量:`}'
titleLength="@{4}"
type="@{DataLayoutType.INPUT}"
value='@{viewModel.totalWeight}' />
<!-- 重量误差(只读) -->
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_weight="1"
enable="@{false}"
hint='@{``}'
title='@{`重量误差:`}'
titleLength="@{5}"
type="@{DataLayoutType.INPUT}"
value='@{viewModel.weightError}' />
</LinearLayout>
<!-- 按钮行 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:gravity="end"
android:orientation="horizontal">
<!-- 修改按钮(只读模式显示) -->
<TextView
android:id="@+id/btnModify"
style="@style/tv_bottom_btn"
android:onClick="@{() -> viewModel.onModifyClick()}"
android:text="修改"
android:visibility="@{viewModel.isEditMode ? View.GONE : View.VISIBLE}" />
<!-- 取消按钮(编辑模式显示) -->
<TextView
android:id="@+id/btnCancel"
style="@style/tv_bottom_btn"
android:layout_marginEnd="10dp"
android:onClick="@{() -> viewModel.onCancelClick()}"
android:text="取消"
android:visibility="@{viewModel.isEditMode ? View.VISIBLE : View.GONE}" />
<!-- 保存按钮(编辑模式显示) -->
<TextView
android:id="@+id/btnSave"
style="@style/tv_bottom_btn"
android:onClick="@{() -> viewModel.onSaveClick()}"
android:text="保存"
android:visibility="@{viewModel.isEditMode ? View.VISIBLE : View.GONE}" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</layout>

View File

@@ -0,0 +1,96 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<data>
<import type="com.lukouguoji.module_base.ui.weight.data.layout.DataLayoutType" />
<variable
name="record"
type="com.lukouguoji.module_base.bean.GjcCheckInRecord" />
<variable
name="isEditMode"
type="Boolean" />
<variable
name="position"
type="Integer" />
</data>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:background="@drawable/bg_white_radius_8"
android:orientation="horizontal"
android:padding="15dp">
<!-- 序号(只读) -->
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.5"
enable="@{false}"
hint='@{`序号`}'
title='@{`序号:`}'
titleLength="@{4}"
type="@{DataLayoutType.INPUT}"
value='@{String.valueOf(position + 1)}' />
<!-- 件数(可编辑) -->
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
android:id="@+id/padPc"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_weight="1"
enable="@{isEditMode}"
hint='@{`请输入件数`}'
title='@{`件数:`}'
titleLength="@{4}"
type="@{DataLayoutType.INPUT}"
value='@{String.valueOf(record.pc)}' />
<!-- 重量(可编辑) -->
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
android:id="@+id/padWeight"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_weight="1"
enable="@{isEditMode}"
hint='@{`请输入重量`}'
title='@{`重量:`}'
titleLength="@{4}"
type="@{DataLayoutType.INPUT}"
value='@{String.valueOf(record.weight)}' />
<!-- 托盘自重只读固定显示0 -->
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_weight="1"
enable="@{false}"
hint='@{``}'
title='@{`托盘自重:`}'
titleLength="@{5}"
type="@{DataLayoutType.INPUT}"
value='@{`0`}' />
<!-- 计重时间(只读) -->
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_weight="1.5"
enable="@{false}"
hint='@{``}'
title='@{`计重时间:`}'
titleLength="@{5}"
type="@{DataLayoutType.INPUT}"
value='@{record.opDate}' />
</LinearLayout>
</layout>