采购单入库商品默认显示采购单信息;采集数据显示优化

This commit is contained in:
2026-03-05 16:26:38 +08:00
parent f219c57fad
commit d50b11c9aa
9 changed files with 321 additions and 274 deletions
@@ -1,157 +1,157 @@
package com.sw.inbound.ui.weight
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.itemsIndexed
import androidx.compose.material3.HorizontalDivider
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.colorResource
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import com.sw.inbound.R
import com.sw.inbound.ext.bold
import com.sw.inbound.model.response.GoodsInfo
import com.sw.inbound.ui.theme.AppTypography
import com.sw.inbound.ui.theme.Gray_DCDCF0
/**
* 收货-未调整列表
*/
@Composable
fun ReceiptUnadjustedListView(
modifier: Modifier = Modifier,
productList: List<GoodsInfo>,
checkedItem: GoodsInfo? = null,
onItemCheckedClick: (Int, GoodsInfo) -> Unit = { _, _ -> },
showClose: Boolean = false,
onCloseClick: (GoodsInfo) -> Unit = {},
) {
var selectIndex by remember { mutableIntStateOf(-1) }
Column(
modifier = modifier
// .padding(horizontal = 30.dp)
) {
// 左侧列表标题
Row(
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 60.dp)
.height(84.dp),
verticalAlignment = Alignment.CenterVertically
) {
CustomSingleRightText(
modifier = Modifier.weight(1f),
text = "名称",
style = AppTypography.gray96a0aaTextStyle.bold(),
textAlign = TextAlign.Start
)
Spacer(modifier = Modifier.width(10.dp))
CustomSingleRightText(
modifier = Modifier.width(120.dp),
text = "单价(元)",
style = AppTypography.gray96a0aaTextStyle.bold()
)
Spacer(modifier = Modifier.width(20.dp))
CustomSingleRightText(
modifier = Modifier.width(200.dp),
text = "数量",
style = AppTypography.gray96a0aaTextStyle.bold()
)
Spacer(modifier = Modifier.width(20.dp))
CustomSingleRightText(
modifier = Modifier.width(120.dp),
text = "金额(元)",
style = AppTypography.gray96a0aaTextStyle.bold()
)
if (showClose) {
Spacer(modifier = Modifier.width(78.dp))
}
}
// Spacer(modifier = Modifier.height(31.dp))
HorizontalDivider(thickness = 1.dp, color = colorResource(R.color.divider))
// Spacer(modifier = Modifier.height(31.dp))
// 左侧列表
LazyColumn() {
itemsIndexed(
items = productList,
// key = { index, it -> it.id ?: index }) { index, it ->
key = { index, it -> index }) { index, it ->
val checkedBg =
if (/*selectIndex == index ||*/ checkedItem?.id == it.id) Gray_DCDCF0 else Color.Transparent
Row(
modifier = Modifier
.background(color = checkedBg)
.height(80.dp)
.padding(horizontal = 60.dp)
.clickable {
selectIndex = index
onItemCheckedClick(index, it)
}, verticalAlignment = Alignment.CenterVertically
) {
CustomSingleRightText(
modifier = Modifier.weight(1f),
text = it.goodNameStr,
textAlign = TextAlign.Start
)
Spacer(modifier = Modifier.width(10.dp))
CustomSingleRightText(
modifier = Modifier.width(120.dp),
text = it.recUnitPriceTaxInListStr,
style = AppTypography.blackTextStyle
)
Spacer(modifier = Modifier.width(20.dp))
CustomSingleRightText(
modifier = Modifier.width(200.dp),
text = "${it.dualCountStr}${it.unitNameStr}",
style = AppTypography.blackTextStyle
)
Spacer(modifier = Modifier.width(20.dp))
CustomSingleRightText(
modifier = Modifier.width(120.dp),
text = it.recPriceExItemListStr,
style = AppTypography.blackTextStyle
)
if (showClose) {
Spacer(modifier = Modifier.width(30.dp))
Image(
modifier = Modifier
.size(48.dp)
.clickable {
onCloseClick(it)
},
painter = painterResource(R.mipmap.ic_delete),
contentDescription = "删除"
)
}
}
// Spacer(modifier = Modifier.height(33.dp))
// if (productList.indexOf(it) != productList.lastIndex)
HorizontalDivider(
thickness = 1.dp,
color = colorResource(R.color.divider)
)
// Spacer(modifier = Modifier.height(33.dp))
}
}
}
}
//package com.sw.inbound.ui.weight
//
//import androidx.compose.foundation.Image
//import androidx.compose.foundation.background
//import androidx.compose.foundation.clickable
//import androidx.compose.foundation.layout.Column
//import androidx.compose.foundation.layout.Row
//import androidx.compose.foundation.layout.Spacer
//import androidx.compose.foundation.layout.fillMaxWidth
//import androidx.compose.foundation.layout.height
//import androidx.compose.foundation.layout.padding
//import androidx.compose.foundation.layout.size
//import androidx.compose.foundation.layout.width
//import androidx.compose.foundation.lazy.LazyColumn
//import androidx.compose.foundation.lazy.itemsIndexed
//import androidx.compose.material3.HorizontalDivider
//import androidx.compose.runtime.Composable
//import androidx.compose.runtime.getValue
//import androidx.compose.runtime.mutableIntStateOf
//import androidx.compose.runtime.remember
//import androidx.compose.runtime.setValue
//import androidx.compose.ui.Alignment
//import androidx.compose.ui.Modifier
//import androidx.compose.ui.graphics.Color
//import androidx.compose.ui.res.colorResource
//import androidx.compose.ui.res.painterResource
//import androidx.compose.ui.text.style.TextAlign
//import androidx.compose.ui.unit.dp
//import com.sw.inbound.R
//import com.sw.inbound.ext.bold
//import com.sw.inbound.model.response.GoodsInfo
//import com.sw.inbound.ui.theme.AppTypography
//import com.sw.inbound.ui.theme.Gray_DCDCF0
//
///**
// * 收货-未调整列表
// */
//@Composable
//fun ReceiptUnadjustedListView(
// modifier: Modifier = Modifier,
// productList: List<GoodsInfo>,
// checkedItem: GoodsInfo? = null,
// onItemCheckedClick: (Int, GoodsInfo) -> Unit = { _, _ -> },
// showClose: Boolean = false,
// onCloseClick: (GoodsInfo) -> Unit = {},
//) {
// var selectIndex by remember { mutableIntStateOf(-1) }
//
// Column(
// modifier = modifier
//// .padding(horizontal = 30.dp)
// ) {
// // 左侧列表标题
// Row(
// modifier = Modifier
// .fillMaxWidth()
// .padding(horizontal = 60.dp)
// .height(84.dp),
// verticalAlignment = Alignment.CenterVertically
// ) {
// CustomSingleRightText(
// modifier = Modifier.weight(1f),
// text = "名称",
// style = AppTypography.gray96a0aaTextStyle.bold(),
// textAlign = TextAlign.Start
// )
// Spacer(modifier = Modifier.width(10.dp))
// CustomSingleRightText(
// modifier = Modifier.width(120.dp),
// text = "单价(元)",
// style = AppTypography.gray96a0aaTextStyle.bold()
// )
// Spacer(modifier = Modifier.width(20.dp))
// CustomSingleRightText(
// modifier = Modifier.width(200.dp),
// text = "数量",
// style = AppTypography.gray96a0aaTextStyle.bold()
// )
// Spacer(modifier = Modifier.width(20.dp))
// CustomSingleRightText(
// modifier = Modifier.width(120.dp),
// text = "金额(元)",
// style = AppTypography.gray96a0aaTextStyle.bold()
// )
// if (showClose) {
// Spacer(modifier = Modifier.width(78.dp))
// }
// }
//// Spacer(modifier = Modifier.height(31.dp))
// HorizontalDivider(thickness = 1.dp, color = colorResource(R.color.divider))
//// Spacer(modifier = Modifier.height(31.dp))
// // 左侧列表
// LazyColumn() {
// itemsIndexed(
// items = productList,
//// key = { index, it -> it.id ?: index }) { index, it ->
// key = { index, it -> index }) { index, it ->
//
// val checkedBg =
// if (/*selectIndex == index ||*/ checkedItem?.id == it.id) Gray_DCDCF0 else Color.Transparent
// Row(
// modifier = Modifier
// .background(color = checkedBg)
// .height(80.dp)
// .padding(horizontal = 60.dp)
// .clickable {
// selectIndex = index
// onItemCheckedClick(index, it)
// }, verticalAlignment = Alignment.CenterVertically
// ) {
// CustomSingleRightText(
// modifier = Modifier.weight(1f),
// text = it.goodNameStr,
// textAlign = TextAlign.Start
// )
// Spacer(modifier = Modifier.width(10.dp))
// CustomSingleRightText(
// modifier = Modifier.width(120.dp),
// text = it.recUnitPriceTaxInListStr,
// style = AppTypography.blackTextStyle
// )
// Spacer(modifier = Modifier.width(20.dp))
// CustomSingleRightText(
// modifier = Modifier.width(200.dp),
// text = "${it.dualCountStr}${it.unitNameStr}",
// style = AppTypography.blackTextStyle
// )
// Spacer(modifier = Modifier.width(20.dp))
// CustomSingleRightText(
// modifier = Modifier.width(120.dp),
// text = it.recPriceExItemListStr,
// style = AppTypography.blackTextStyle
// )
// if (showClose) {
// Spacer(modifier = Modifier.width(30.dp))
// Image(
// modifier = Modifier
// .size(48.dp)
// .clickable {
// onCloseClick(it)
// },
// painter = painterResource(R.mipmap.ic_delete),
// contentDescription = "删除"
// )
// }
// }
//// Spacer(modifier = Modifier.height(33.dp))
//// if (productList.indexOf(it) != productList.lastIndex)
// HorizontalDivider(
// thickness = 1.dp,
// color = colorResource(R.color.divider)
// )
//// Spacer(modifier = Modifier.height(33.dp))
// }
// }
// }
//}