|
|
@@ -1,28 +1,584 @@
|
|
|
package cn.muchinfo.rma.view.base.home.commodity.flow
|
|
|
|
|
|
import android.os.Bundle
|
|
|
-import cn.muchinfo.rma.view.autoWidget.commonLeftButton
|
|
|
-import cn.muchinfo.rma.view.autoWidget.commonTitle
|
|
|
-import cn.muchinfo.rma.view.autoWidget.topBar
|
|
|
+import android.view.Gravity
|
|
|
+import android.view.MotionEvent
|
|
|
+import android.view.View
|
|
|
+import android.view.ViewGroup
|
|
|
+import androidx.appcompat.app.AppCompatActivity
|
|
|
+import androidx.recyclerview.widget.LinearLayoutManager
|
|
|
+import androidx.recyclerview.widget.RecyclerView
|
|
|
+import androidx.viewpager.widget.PagerAdapter
|
|
|
+import androidx.viewpager.widget.ViewPager
|
|
|
+import cn.muchinfo.rma.R
|
|
|
+import cn.muchinfo.rma.global.GlobalDataCollection
|
|
|
+import cn.muchinfo.rma.global.data.DeliveryGoodsDetailData
|
|
|
+import cn.muchinfo.rma.global.data.XhWrstandard
|
|
|
+import cn.muchinfo.rma.lifecycle.bindOptional
|
|
|
+import cn.muchinfo.rma.view.autoWidget.*
|
|
|
import cn.muchinfo.rma.view.base.BaseActivity
|
|
|
-import org.jetbrains.anko.verticalLayout
|
|
|
+import cn.muchinfo.rma.view.base.home.inventory.inventoryaudit.InStorage
|
|
|
+import cn.muchinfo.rma.view.base.home.inventory.inventoryaudit.InventoryContentAdapter
|
|
|
+import cn.muchinfo.rma.view.base.home.inventory.inventoryaudit.OutStorage
|
|
|
+import cn.muchinfo.rma.view.base.procurement.TopTabAdpater
|
|
|
+import com.blankj.utilcode.util.ConvertUtils
|
|
|
+import com.qmuiteam.qmui.util.QMUIDisplayHelper
|
|
|
+import com.qmuiteam.qmui.widget.tab.QMUITabIndicator
|
|
|
+import com.qmuiteam.qmui.widget.tab.QMUITabSegment
|
|
|
+import org.jetbrains.anko.*
|
|
|
+import org.jetbrains.anko.support.v4.viewPager
|
|
|
|
|
|
/**
|
|
|
* 商品修改流水页面
|
|
|
*/
|
|
|
class CommodityModificationFlowActivity : BaseActivity<CommodityModificationFlowViewModel>(){
|
|
|
|
|
|
+ val data by lazy { intent.getParcelableExtra<XhWrstandard>("data") as XhWrstandard }
|
|
|
+
|
|
|
+ val deliveryGoodsDetailData by lazy { intent.getParcelableExtra<DeliveryGoodsDetailData>("deliveryGoodsDetailData") as DeliveryGoodsDetailData }
|
|
|
+
|
|
|
+
|
|
|
+ lateinit var segment: QMUITabSegment
|
|
|
+ var selectedTabIndex: Int = 0
|
|
|
+ private lateinit var viewPager: ViewPager
|
|
|
+
|
|
|
+ //增值税税率
|
|
|
+ private val vatRateUI by lazy { VatRateUI(this,viewModel,data,deliveryGoodsDetailData) }
|
|
|
+ //折算系数
|
|
|
+ private val convertCoefficientUI by lazy { ConvertCoefficientUI(this,viewModel,data,deliveryGoodsDetailData) }
|
|
|
+ //成本权重
|
|
|
+ private val costWeightUI by lazy { CostWeightUI(this,viewModel,data,deliveryGoodsDetailData) }
|
|
|
+
|
|
|
+ //viewpager的适配器
|
|
|
+ private var newPagerAdapter : PagerAdapter? = null
|
|
|
+
|
|
|
+ //tabSegment标题
|
|
|
+ private val newTabsArray : ArrayList<String> = arrayListOf()
|
|
|
+
|
|
|
+ //暂存的页面组
|
|
|
+ private val uiList : ArrayList<_FrameLayout> = arrayListOf()
|
|
|
+
|
|
|
+ fun initMenuData(){
|
|
|
+
|
|
|
+ newTabsArray.add("增值税税率")
|
|
|
+ uiList.add(vatRateUI.root)
|
|
|
+
|
|
|
+ newTabsArray.add("折算系数")
|
|
|
+ uiList.add(convertCoefficientUI.root)
|
|
|
+
|
|
|
+ newTabsArray.add("成本权重")
|
|
|
+ uiList.add(costWeightUI.root)
|
|
|
+
|
|
|
+ newPagerAdapter = object : PagerAdapter() {
|
|
|
+
|
|
|
+ override fun getPageTitle(position: Int): CharSequence? = newTabsArray[position]
|
|
|
+
|
|
|
+ override fun instantiateItem(container: ViewGroup, position: Int): Any {
|
|
|
+ return uiList.get(position).apply {
|
|
|
+ container.addView(
|
|
|
+ this,
|
|
|
+ ViewGroup.LayoutParams(matchParent, matchParent)
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ override fun destroyItem(container: ViewGroup, position: Int, `object`: Any) {
|
|
|
+ (`object` as? View)?.let { container.removeView(it) }
|
|
|
+ }
|
|
|
+
|
|
|
+ override fun isViewFromObject(view: View, `object`: Any): Boolean = view == `object`
|
|
|
+
|
|
|
+ override fun getCount(): Int = newTabsArray.size
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
|
super.onCreate(savedInstanceState)
|
|
|
verticalLayout {
|
|
|
+ initMenuData()
|
|
|
topBar {
|
|
|
commonLeftButton()
|
|
|
commonTitle{
|
|
|
text = "修改流水"
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ tabSegment {
|
|
|
+ segment = this
|
|
|
+ background = resources.getDrawable(R.color.segtabment_bg_color)
|
|
|
+ addOnTabSelectedListener(object :
|
|
|
+ QMUITabSegment.OnTabSelectedListener {
|
|
|
+ override fun onDoubleTap(index: Int) {}
|
|
|
+ override fun onTabReselected(index: Int) {}
|
|
|
+ override fun onTabUnselected(index: Int) {}
|
|
|
+ override fun onTabSelected(index: Int) {
|
|
|
+ selectedTabIndex = index
|
|
|
+ }
|
|
|
+ })
|
|
|
+ setIndicator(
|
|
|
+ QMUITabIndicator(
|
|
|
+ QMUIDisplayHelper.dp2px(context, 2),
|
|
|
+ false,
|
|
|
+ true
|
|
|
+ )
|
|
|
+ )
|
|
|
+ setDefaultTextSize(ConvertUtils.sp2px(16f), ConvertUtils.sp2px(16f))
|
|
|
+ }.lparams(matchParent, autoSize(80))
|
|
|
+
|
|
|
+ view {
|
|
|
+ background = resources.getDrawable(R.color.main_hit_bg_color)
|
|
|
+ }.lparams(matchParent, autoSize(1)) {
|
|
|
+ marginStart = autoSize(32)
|
|
|
+ marginEnd = autoSize(32)
|
|
|
+ }
|
|
|
+ viewPager {
|
|
|
+ background = resources.getDrawable(R.color.white)
|
|
|
+ viewPager = this
|
|
|
+ adapter = newPagerAdapter
|
|
|
+ }.lparams(matchParent, matchParent)
|
|
|
+
|
|
|
+ segment.setupWithViewPager(viewPager)
|
|
|
+ segment.selectTab(selectedTabIndex)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
+/**
|
|
|
+ * 增值税税率流水
|
|
|
+ * @property activity AppCompatActivity
|
|
|
+ * @property viewModel CommodityModificationFlowViewModel
|
|
|
+ * @constructor
|
|
|
+ */
|
|
|
+class VatRateUI(private val activity : AppCompatActivity,private val viewModel: CommodityModificationFlowViewModel,private val data : XhWrstandard,private val deliveryGoodsDetailData : DeliveryGoodsDetailData) : ModificationFlowContentAdapter.OnContentScrollListener{
|
|
|
+
|
|
|
+
|
|
|
+ private lateinit var swipeToLayout: SwipeToLoadLayout
|
|
|
+ private lateinit var statusLayout: StatusLayout
|
|
|
+ lateinit var horScrollview: CustomHorizontalScrollView
|
|
|
+ lateinit var recyclerView: RecyclerView
|
|
|
+
|
|
|
+ val topAdapter by lazy {
|
|
|
+ TopTabAdpater(activity)
|
|
|
+ }
|
|
|
+
|
|
|
+ val exposureContentAdapter by lazy {
|
|
|
+ ModificationFlowContentAdapter(activity)
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ val root = _FrameLayout(activity).apply {
|
|
|
+ verticalLayout {
|
|
|
+ viewModel.queryRateTitle(deliverygoodsid = deliveryGoodsDetailData.deliverygoodsid ?: "",wrstandardid = data.wrstandardid ?: "")
|
|
|
+ exposureContentAdapter.setOnContentScrollListener(this@VatRateUI)
|
|
|
+ linearLayout {
|
|
|
+ linearLayout {
|
|
|
+ gravity = Gravity.LEFT or Gravity.CENTER_VERTICAL
|
|
|
+ textView {//头部右侧数据
|
|
|
+ viewModel.rateTitleDataList.bindOptional(context) {
|
|
|
+ text = it?.get(0)?.columntitle?.replace("\\n", "\n") ?: ""
|
|
|
+ }
|
|
|
+ textColorStr = "#AAAAAA"
|
|
|
+ textSizeAuto = 24
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginStart = autoSize(30)
|
|
|
+ }
|
|
|
+ }.lparams(autoSize(250), autoSize(100))
|
|
|
+
|
|
|
+ inflateLayout<CustomHorizontalScrollView>(R.layout.scrollview) {
|
|
|
+ horScrollview = this
|
|
|
+ /**
|
|
|
+ * 用来同步内容列表的item左右滑动
|
|
|
+ */
|
|
|
+ setOnCustomScrollChangeListener { listener, scrollX, scrollY, oldScrollX, oldScrollY ->
|
|
|
+ exposureContentAdapter.offestX = scrollX
|
|
|
+ val viewHolderCacheList: List<ModificationFlowContentAdapter.ItemViewHolder> =
|
|
|
+ exposureContentAdapter.viewHolderCacheList
|
|
|
+ if (null != viewHolderCacheList) {
|
|
|
+ val size = viewHolderCacheList.size
|
|
|
+ for (i in 0 until size) {
|
|
|
+ viewHolderCacheList[i].exposure_horItemScrollview.scrollTo(
|
|
|
+ scrollX,
|
|
|
+ 0
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ relativeLayout {
|
|
|
+ recyclerView {//头部右侧数据
|
|
|
+ val linearLayoutManager = LinearLayoutManager(context)
|
|
|
+ linearLayoutManager.orientation = LinearLayoutManager.HORIZONTAL
|
|
|
+ layoutManager = linearLayoutManager
|
|
|
+ background = resources.getDrawable(R.color.white)
|
|
|
+ adapter = topAdapter
|
|
|
+ }
|
|
|
+ viewModel.rateTitleDataList.bindOptional(context) {
|
|
|
+ val titleStringList = arrayListOf<String>()
|
|
|
+ it?.subList(1, it.size)?.forEach { data ->
|
|
|
+ titleStringList.add(data.columntitle?.replace("\\n", "\n") ?: "")
|
|
|
+ }
|
|
|
+ topAdapter.setDatas(titleStringList)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }.lparams(matchParent, matchParent)
|
|
|
+ }.lparams(matchParent, autoSize(100))
|
|
|
+
|
|
|
+ statusLayout(contentBlock = {
|
|
|
+ statusLayout = this
|
|
|
+// bindTaskStatus(viewModule.status)
|
|
|
+ swipeToLoadLayout {
|
|
|
+ swipeToLayout = this
|
|
|
+ setEnableRefresh(true)
|
|
|
+ setEnableLoadMore(false)
|
|
|
+ setOnRefreshListener {
|
|
|
+ /**
|
|
|
+ * 下拉刷新
|
|
|
+ */
|
|
|
+ viewModel.queryRateDataList(deliverygoodsid = deliveryGoodsDetailData.deliverygoodsid ?: "",wrstandardid = data.wrstandardid ?: "")
|
|
|
+ }
|
|
|
+ setEnableScrollContentWhenLoaded(false)
|
|
|
+ setEnableLoadMoreWhenContentNotFull(false)
|
|
|
+
|
|
|
+ recyclerView {
|
|
|
+ background = resources.getDrawable(R.color.white)
|
|
|
+ adapter = exposureContentAdapter
|
|
|
+ addOnScrollListener(object : RecyclerView.OnScrollListener() {
|
|
|
+ override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
|
|
|
+ super.onScrolled(recyclerView, dx, dy)
|
|
|
+ val viewHolderCacheList: List<ModificationFlowContentAdapter.ItemViewHolder> =
|
|
|
+ exposureContentAdapter.viewHolderCacheList
|
|
|
+ if (null != viewHolderCacheList) {
|
|
|
+ val size = viewHolderCacheList.size
|
|
|
+ for (i in 0 until size) {
|
|
|
+ viewHolderCacheList[i].exposure_horItemScrollview.scrollTo(
|
|
|
+ exposureContentAdapter.getOffestX(),
|
|
|
+ 0
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }, emptyBlock = {
|
|
|
+ emptyView(hint = resources.getString(R.string.now_no_data))
|
|
|
+ }).lparams(matchParent, matchParent)
|
|
|
+
|
|
|
+
|
|
|
+ //出库待审核
|
|
|
+ viewModel.rateContentDataList.bindOptional(context) {
|
|
|
+ if (it?.isEmpty() == true || it?.size == 0) {
|
|
|
+ statusLayout.showEmpty()
|
|
|
+ } else {
|
|
|
+ if (swipeToLayout.getIsRefreshing()) {
|
|
|
+ swipeToLayout.finishRefresh()
|
|
|
+ }
|
|
|
+ statusLayout.showSuccess()
|
|
|
+ exposureContentAdapter.setDatas(it)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ override fun onScroll(event: MotionEvent?) {
|
|
|
+ //处理单个item滚动时,顶部tab需要联动
|
|
|
+ if (null != horScrollview) horScrollview.onTouchEvent(event)
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * 折算系数页面ui
|
|
|
+ * @property activity AppCompatActivity
|
|
|
+ * @property viewModel CommodityModificationFlowViewModel
|
|
|
+ * @property swipeToLayout SwipeToLoadLayout
|
|
|
+ * @property statusLayout StatusLayout
|
|
|
+ * @property horScrollview CustomHorizontalScrollView
|
|
|
+ * @property recyclerView RecyclerView
|
|
|
+ * @property topAdapter TopTabAdpater
|
|
|
+ * @property exposureContentAdapter ModificationFlowContentAdapter
|
|
|
+ * @property root _FrameLayout
|
|
|
+ * @constructor
|
|
|
+ */
|
|
|
+class ConvertCoefficientUI(private val activity : AppCompatActivity,private val viewModel: CommodityModificationFlowViewModel,private val data : XhWrstandard,private val deliveryGoodsDetailData : DeliveryGoodsDetailData) : ModificationFlowContentAdapter.OnContentScrollListener{
|
|
|
+
|
|
|
+
|
|
|
+ private lateinit var swipeToLayout: SwipeToLoadLayout
|
|
|
+ private lateinit var statusLayout: StatusLayout
|
|
|
+ lateinit var horScrollview: CustomHorizontalScrollView
|
|
|
+ lateinit var recyclerView: RecyclerView
|
|
|
+
|
|
|
+ val topAdapter by lazy {
|
|
|
+ TopTabAdpater(activity)
|
|
|
+ }
|
|
|
+
|
|
|
+ val exposureContentAdapter by lazy {
|
|
|
+ ModificationFlowContentAdapter(activity)
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ val root = _FrameLayout(activity).apply {
|
|
|
+ verticalLayout {
|
|
|
+ viewModel.queryConvertCoefficientTitle(deliverygoodsid = deliveryGoodsDetailData.deliverygoodsid ?: "",wrstandardid = data.wrstandardid ?: "")
|
|
|
+ exposureContentAdapter.setOnContentScrollListener(this@ConvertCoefficientUI)
|
|
|
+ linearLayout {
|
|
|
+ linearLayout {
|
|
|
+ gravity = Gravity.LEFT or Gravity.CENTER_VERTICAL
|
|
|
+ textView {//头部右侧数据
|
|
|
+ viewModel.convertCoefficientTitleDataList.bindOptional(context) {
|
|
|
+ text = it?.get(0)?.columntitle?.replace("\\n", "\n") ?: ""
|
|
|
+ }
|
|
|
+ textColorStr = "#AAAAAA"
|
|
|
+ textSizeAuto = 24
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginStart = autoSize(30)
|
|
|
+ }
|
|
|
+ }.lparams(autoSize(250), autoSize(100))
|
|
|
+
|
|
|
+ inflateLayout<CustomHorizontalScrollView>(R.layout.scrollview) {
|
|
|
+ horScrollview = this
|
|
|
+ /**
|
|
|
+ * 用来同步内容列表的item左右滑动
|
|
|
+ */
|
|
|
+ setOnCustomScrollChangeListener { listener, scrollX, scrollY, oldScrollX, oldScrollY ->
|
|
|
+ exposureContentAdapter.offestX = scrollX
|
|
|
+ val viewHolderCacheList: List<ModificationFlowContentAdapter.ItemViewHolder> =
|
|
|
+ exposureContentAdapter.viewHolderCacheList
|
|
|
+ if (null != viewHolderCacheList) {
|
|
|
+ val size = viewHolderCacheList.size
|
|
|
+ for (i in 0 until size) {
|
|
|
+ viewHolderCacheList[i].exposure_horItemScrollview.scrollTo(
|
|
|
+ scrollX,
|
|
|
+ 0
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ relativeLayout {
|
|
|
+ recyclerView {//头部右侧数据
|
|
|
+ val linearLayoutManager = LinearLayoutManager(context)
|
|
|
+ linearLayoutManager.orientation = LinearLayoutManager.HORIZONTAL
|
|
|
+ layoutManager = linearLayoutManager
|
|
|
+ background = resources.getDrawable(R.color.white)
|
|
|
+ adapter = topAdapter
|
|
|
+ }
|
|
|
+ viewModel.convertCoefficientTitleDataList.bindOptional(context) {
|
|
|
+ val titleStringList = arrayListOf<String>()
|
|
|
+ it?.subList(1, it.size)?.forEach { data ->
|
|
|
+ titleStringList.add(data.columntitle?.replace("\\n", "\n") ?: "")
|
|
|
+ }
|
|
|
+ topAdapter.setDatas(titleStringList)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }.lparams(matchParent, matchParent)
|
|
|
+ }.lparams(matchParent, autoSize(100))
|
|
|
+
|
|
|
+ statusLayout(contentBlock = {
|
|
|
+ statusLayout = this
|
|
|
+// bindTaskStatus(viewModule.status)
|
|
|
+ swipeToLoadLayout {
|
|
|
+ swipeToLayout = this
|
|
|
+ setEnableRefresh(true)
|
|
|
+ setEnableLoadMore(false)
|
|
|
+ setOnRefreshListener {
|
|
|
+ /**
|
|
|
+ * 下拉刷新
|
|
|
+ */
|
|
|
+ viewModel.queryConvertCoefficientDataList(deliverygoodsid = deliveryGoodsDetailData.deliverygoodsid ?: "",wrstandardid = data.wrstandardid ?: "")
|
|
|
+ }
|
|
|
+ setEnableScrollContentWhenLoaded(false)
|
|
|
+ setEnableLoadMoreWhenContentNotFull(false)
|
|
|
+
|
|
|
+ recyclerView {
|
|
|
+ background = resources.getDrawable(R.color.white)
|
|
|
+ adapter = exposureContentAdapter
|
|
|
+ addOnScrollListener(object : RecyclerView.OnScrollListener() {
|
|
|
+ override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
|
|
|
+ super.onScrolled(recyclerView, dx, dy)
|
|
|
+ val viewHolderCacheList: List<ModificationFlowContentAdapter.ItemViewHolder> =
|
|
|
+ exposureContentAdapter.viewHolderCacheList
|
|
|
+ if (null != viewHolderCacheList) {
|
|
|
+ val size = viewHolderCacheList.size
|
|
|
+ for (i in 0 until size) {
|
|
|
+ viewHolderCacheList[i].exposure_horItemScrollview.scrollTo(
|
|
|
+ exposureContentAdapter.getOffestX(),
|
|
|
+ 0
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }, emptyBlock = {
|
|
|
+ emptyView(hint = resources.getString(R.string.now_no_data))
|
|
|
+ }).lparams(matchParent, matchParent)
|
|
|
+
|
|
|
+
|
|
|
+ //出库待审核
|
|
|
+ viewModel.convertCoefficientContentDataList.bindOptional(context) {
|
|
|
+ if (it?.isEmpty() == true || it?.size == 0) {
|
|
|
+ statusLayout.showEmpty()
|
|
|
+ } else {
|
|
|
+ if (swipeToLayout.getIsRefreshing()) {
|
|
|
+ swipeToLayout.finishRefresh()
|
|
|
+ }
|
|
|
+ statusLayout.showSuccess()
|
|
|
+ exposureContentAdapter.setDatas(it)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ override fun onScroll(event: MotionEvent?) {
|
|
|
+ //处理单个item滚动时,顶部tab需要联动
|
|
|
+ if (null != horScrollview) horScrollview.onTouchEvent(event)
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * 成本权重ui
|
|
|
+ * @property activity AppCompatActivity
|
|
|
+ * @property viewModel CommodityModificationFlowViewModel
|
|
|
+ * @constructor
|
|
|
+ */
|
|
|
+class CostWeightUI(private val activity : AppCompatActivity,private val viewModel: CommodityModificationFlowViewModel,private val data : XhWrstandard,private val deliveryGoodsDetailData : DeliveryGoodsDetailData) : ModificationFlowContentAdapter.OnContentScrollListener{
|
|
|
+
|
|
|
+
|
|
|
+ private lateinit var swipeToLayout: SwipeToLoadLayout
|
|
|
+ private lateinit var statusLayout: StatusLayout
|
|
|
+ lateinit var horScrollview: CustomHorizontalScrollView
|
|
|
+ lateinit var recyclerView: RecyclerView
|
|
|
+
|
|
|
+ val topAdapter by lazy {
|
|
|
+ TopTabAdpater(activity)
|
|
|
+ }
|
|
|
+
|
|
|
+ val exposureContentAdapter by lazy {
|
|
|
+ ModificationFlowContentAdapter(activity)
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ val root = _FrameLayout(activity).apply {
|
|
|
+ verticalLayout {
|
|
|
+ viewModel.queryCostWeightTitle(deliverygoodsid = deliveryGoodsDetailData.deliverygoodsid ?: "",wrstandardid = data.wrstandardid ?: "")
|
|
|
+ exposureContentAdapter.setOnContentScrollListener(this@CostWeightUI)
|
|
|
+ linearLayout {
|
|
|
+ linearLayout {
|
|
|
+ gravity = Gravity.LEFT or Gravity.CENTER_VERTICAL
|
|
|
+ textView {//头部右侧数据
|
|
|
+ viewModel.costWeightTitleDataList.bindOptional(context) {
|
|
|
+ text = it?.get(0)?.columntitle?.replace("\\n", "\n") ?: ""
|
|
|
+ }
|
|
|
+ textColorStr = "#AAAAAA"
|
|
|
+ textSizeAuto = 24
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginStart = autoSize(30)
|
|
|
+ }
|
|
|
+ }.lparams(autoSize(250), autoSize(100))
|
|
|
+
|
|
|
+ inflateLayout<CustomHorizontalScrollView>(R.layout.scrollview) {
|
|
|
+ horScrollview = this
|
|
|
+ /**
|
|
|
+ * 用来同步内容列表的item左右滑动
|
|
|
+ */
|
|
|
+ setOnCustomScrollChangeListener { listener, scrollX, scrollY, oldScrollX, oldScrollY ->
|
|
|
+ exposureContentAdapter.offestX = scrollX
|
|
|
+ val viewHolderCacheList: List<ModificationFlowContentAdapter.ItemViewHolder> =
|
|
|
+ exposureContentAdapter.viewHolderCacheList
|
|
|
+ if (null != viewHolderCacheList) {
|
|
|
+ val size = viewHolderCacheList.size
|
|
|
+ for (i in 0 until size) {
|
|
|
+ viewHolderCacheList[i].exposure_horItemScrollview.scrollTo(
|
|
|
+ scrollX,
|
|
|
+ 0
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ relativeLayout {
|
|
|
+ recyclerView {//头部右侧数据
|
|
|
+ val linearLayoutManager = LinearLayoutManager(context)
|
|
|
+ linearLayoutManager.orientation = LinearLayoutManager.HORIZONTAL
|
|
|
+ layoutManager = linearLayoutManager
|
|
|
+ background = resources.getDrawable(R.color.white)
|
|
|
+ adapter = topAdapter
|
|
|
+ }
|
|
|
+ viewModel.costWeightTitleDataList.bindOptional(context) {
|
|
|
+ val titleStringList = arrayListOf<String>()
|
|
|
+ it?.subList(1, it.size)?.forEach { data ->
|
|
|
+ titleStringList.add(data.columntitle?.replace("\\n", "\n") ?: "")
|
|
|
+ }
|
|
|
+ topAdapter.setDatas(titleStringList)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }.lparams(matchParent, matchParent)
|
|
|
+ }.lparams(matchParent, autoSize(100))
|
|
|
+
|
|
|
+ statusLayout(contentBlock = {
|
|
|
+ statusLayout = this
|
|
|
+// bindTaskStatus(viewModule.status)
|
|
|
+ swipeToLoadLayout {
|
|
|
+ swipeToLayout = this
|
|
|
+ setEnableRefresh(true)
|
|
|
+ setEnableLoadMore(false)
|
|
|
+ setOnRefreshListener {
|
|
|
+ /**
|
|
|
+ * 下拉刷新
|
|
|
+ */
|
|
|
+ viewModel.queryCostWeightDataList(deliverygoodsid = deliveryGoodsDetailData.deliverygoodsid ?: "",wrstandardid = data.wrstandardid ?: "")
|
|
|
+ }
|
|
|
+ setEnableScrollContentWhenLoaded(false)
|
|
|
+ setEnableLoadMoreWhenContentNotFull(false)
|
|
|
+
|
|
|
+ recyclerView {
|
|
|
+ background = resources.getDrawable(R.color.white)
|
|
|
+ adapter = exposureContentAdapter
|
|
|
+ addOnScrollListener(object : RecyclerView.OnScrollListener() {
|
|
|
+ override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
|
|
|
+ super.onScrolled(recyclerView, dx, dy)
|
|
|
+ val viewHolderCacheList: List<ModificationFlowContentAdapter.ItemViewHolder> =
|
|
|
+ exposureContentAdapter.viewHolderCacheList
|
|
|
+ if (null != viewHolderCacheList) {
|
|
|
+ val size = viewHolderCacheList.size
|
|
|
+ for (i in 0 until size) {
|
|
|
+ viewHolderCacheList[i].exposure_horItemScrollview.scrollTo(
|
|
|
+ exposureContentAdapter.getOffestX(),
|
|
|
+ 0
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }, emptyBlock = {
|
|
|
+ emptyView(hint = resources.getString(R.string.now_no_data))
|
|
|
+ }).lparams(matchParent, matchParent)
|
|
|
+
|
|
|
+
|
|
|
+ //出库待审核
|
|
|
+ viewModel.costWeightContentDataList.bindOptional(context) {
|
|
|
+ if (it?.isEmpty() == true || it?.size == 0) {
|
|
|
+ statusLayout.showEmpty()
|
|
|
+ } else {
|
|
|
+ if (swipeToLayout.getIsRefreshing()) {
|
|
|
+ swipeToLayout.finishRefresh()
|
|
|
+ }
|
|
|
+ statusLayout.showSuccess()
|
|
|
+ exposureContentAdapter.setDatas(it)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ override fun onScroll(event: MotionEvent?) {
|
|
|
+ //处理单个item滚动时,顶部tab需要联动
|
|
|
+ if (null != horScrollview) horScrollview.onTouchEvent(event)
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+}
|