|
@@ -5,7 +5,7 @@ import android.view.LayoutInflater
|
|
|
import android.view.ViewGroup
|
|
|
import android.widget.TextView
|
|
|
import androidx.core.content.res.ResourcesCompat
|
|
|
-import androidx.recyclerview.widget.LinearLayoutManager
|
|
|
+import com.bin.david.form.data.style.FontStyle
|
|
|
import com.pan_american.android.OASystem
|
|
|
import com.pan_american.android.R
|
|
|
import com.pan_american.android.base.BaseFragment
|
|
@@ -93,8 +93,6 @@ class SalesRevenueRankFragment : BaseFragment<FragmentSalesRevenueRankBinding>()
|
|
|
this@SalesRevenueRankFragment.year = year
|
|
|
}
|
|
|
|
|
|
- binding.rank.adapter!!.notifyItemRangeRemoved(0, sellerRank.size)
|
|
|
-
|
|
|
sellerRank.clear()
|
|
|
|
|
|
getSellerRankData()
|
|
@@ -132,16 +130,33 @@ class SalesRevenueRankFragment : BaseFragment<FragmentSalesRevenueRankBinding>()
|
|
|
if (rankResponse != null) {
|
|
|
if (rankResponse.code == 200) {
|
|
|
|
|
|
- if (rankResponse.data.size == 0) {
|
|
|
+ for (item in rankResponse.data) {
|
|
|
+ sellerRank.add(item)
|
|
|
+ }
|
|
|
+
|
|
|
+ if (sellerRank.size == 0) {
|
|
|
showMessage(resources.getString(R.string.no_data))
|
|
|
- return
|
|
|
+ sellerRank.add(SellerRank().apply {
|
|
|
+ rowNumber = 1
|
|
|
+ userName = "-"
|
|
|
+ count = 0
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
- for (item in rankResponse.data) {
|
|
|
- sellerRank.add(item)
|
|
|
+ binding.rankTable.config.apply {
|
|
|
+ isShowTableTitle = false
|
|
|
+ isShowXSequence = false
|
|
|
+ isShowYSequence = false
|
|
|
+ minTableWidth = binding.rankTable.width
|
|
|
+ verticalPadding = resources.getDimensionPixelSize(R.dimen.common_padding)
|
|
|
+ columnTitleStyle = FontStyle(resources.getDimensionPixelSize(R.dimen.text_size_large), ResourcesCompat.getColor(resources, R.color.text_color, null))
|
|
|
+ contentStyle = FontStyle(resources.getDimensionPixelSize(R.dimen.text_size_medium), ResourcesCompat.getColor(resources, R.color.text_color, null))
|
|
|
}
|
|
|
|
|
|
- initList()
|
|
|
+ binding.rankTable.apply {
|
|
|
+ setZoom(false)
|
|
|
+ setData(sellerRank)
|
|
|
+ }
|
|
|
|
|
|
} else {
|
|
|
showMessage(rankResponse.msg)
|
|
@@ -154,28 +169,4 @@ class SalesRevenueRankFragment : BaseFragment<FragmentSalesRevenueRankBinding>()
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
-
|
|
|
- private fun initList() {
|
|
|
-
|
|
|
- val layoutManager = LinearLayoutManager(OASystem.context)
|
|
|
- binding.rank.layoutManager = layoutManager
|
|
|
-
|
|
|
- val adapter = ListAdapter.Builder<SellerRank>().apply {
|
|
|
- setData(sellerRank)
|
|
|
- setLayoutId(R.layout.item_seller_rank)
|
|
|
- addBindView { itemView, data ->
|
|
|
- itemView.findViewById<TextView>(R.id.rank).text = data.rowNumber.toString()
|
|
|
- itemView.findViewById<TextView>(R.id.name).text = data.userName
|
|
|
- itemView.findViewById<TextView>(R.id.seller_order).text = data.count.toString()
|
|
|
- }
|
|
|
- }.create()
|
|
|
-
|
|
|
- binding.rank.adapter = adapter
|
|
|
-
|
|
|
- adapter.onRecyclerViewItemClick = object : ListAdapter.OnRecyclerViewItemClick<SellerRank> {
|
|
|
- override fun onItemClick(position: Int) {
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
}
|