|
|
@@ -52,11 +52,6 @@ class ReportQueryActivity : BaseActivity<ReportQueryViewModel>() {
|
|
|
var selectedTabIndex: Int = 0
|
|
|
private lateinit var viewPager: ViewPager
|
|
|
|
|
|
- /** tab标题 **/
|
|
|
- private val tabsArray: List<String> by lazy {
|
|
|
- arrayListOf("财务报表", "敞口报表", "现货报表", "库存(品类)报表","库存(仓库)报表","汇总损益表")
|
|
|
- }
|
|
|
-
|
|
|
/** 财务报表 **/
|
|
|
private val financialReportUI by lazy { FinancialReportUI(this, viewModel) }
|
|
|
|
|
|
@@ -75,62 +70,56 @@ class ReportQueryActivity : BaseActivity<ReportQueryViewModel>() {
|
|
|
/** 库存(仓库)报表 **/
|
|
|
private val invertoryWarehouseReportUI by lazy { InvertoryWarehouseReportUI(this, viewModel) }
|
|
|
|
|
|
- private val pagerAdapter: PagerAdapter by lazy {
|
|
|
- object : PagerAdapter() {
|
|
|
+ private val dialog by lazy { createLoadingDialog(hintStr = "请求中...") }
|
|
|
+
|
|
|
+ //viewpager的适配器
|
|
|
+ private var newPagerAdapter : PagerAdapter? = null
|
|
|
+
|
|
|
+ //tabSegment标题
|
|
|
+ private val newTabsArray : ArrayList<String> = arrayListOf()
|
|
|
|
|
|
- override fun getPageTitle(position: Int): CharSequence? = tabsArray[position]
|
|
|
+ //暂存的页面组
|
|
|
+ private val uiList : ArrayList<_FrameLayout> = arrayListOf()
|
|
|
+
|
|
|
+ //计算页面有多少个显示页签
|
|
|
+ private val showIndex : MutableLiveData<Int> = MutableLiveData()
|
|
|
+
|
|
|
+ fun initMenuData(){
|
|
|
+ if (GlobalDataCollection.instance?.getSecondLevelMenu(firstCode = "client_report",secondCode = "client_report_exposure") == true){
|
|
|
+ newTabsArray.add("敞口报表")
|
|
|
+ uiList.add(exposureReportUI.root)
|
|
|
+ }
|
|
|
+ if (GlobalDataCollection.instance?.getSecondLevelMenu(firstCode = "client_report",secondCode = "client_report_spot") == true){
|
|
|
+ newTabsArray.add("现货报表")
|
|
|
+ uiList.add(spotReportUI.root)
|
|
|
+ }
|
|
|
+ if (GlobalDataCollection.instance?.getSecondLevelMenu(firstCode = "client_report",secondCode = "client_report_finance") == true){
|
|
|
+ newTabsArray.add("财务报表")
|
|
|
+ uiList.add(financialReportUI.root)
|
|
|
+ }
|
|
|
+ if (GlobalDataCollection.instance?.getSecondLevelMenu(firstCode = "client_report",secondCode = "client_report_wrstandstock") == true){
|
|
|
+ newTabsArray.add("库存(品类)报表")
|
|
|
+ uiList.add(invertoryReportUI.root)
|
|
|
+ }
|
|
|
+ if (GlobalDataCollection.instance?.getSecondLevelMenu(firstCode = "client_report",secondCode = "client_report_warehousestock") == true){
|
|
|
+ newTabsArray.add("库存(仓库)报表")
|
|
|
+ uiList.add(invertoryWarehouseReportUI.root)
|
|
|
+ }
|
|
|
+ if (GlobalDataCollection.instance?.getSecondLevelMenu(firstCode = "client_report",secondCode = "client_report_sumprofit") == true){
|
|
|
+ newTabsArray.add("汇总损益报表")
|
|
|
+ uiList.add(spotEarningReportUI.root)
|
|
|
+ }
|
|
|
+ showIndex.postValue(uiList.size)
|
|
|
+ newPagerAdapter = object : PagerAdapter() {
|
|
|
+
|
|
|
+ override fun getPageTitle(position: Int): CharSequence? = newTabsArray[position]
|
|
|
|
|
|
override fun instantiateItem(container: ViewGroup, position: Int): Any {
|
|
|
- when (position) {
|
|
|
- 0 -> {
|
|
|
- return financialReportUI.root.apply {//财务报表
|
|
|
- container.addView(
|
|
|
- this,
|
|
|
- ViewGroup.LayoutParams(matchParent, matchParent)
|
|
|
- )
|
|
|
- }
|
|
|
- }
|
|
|
- 1 -> {
|
|
|
- return exposureReportUI.root.apply {//敞口报表
|
|
|
- container.addView(
|
|
|
- this,
|
|
|
- ViewGroup.LayoutParams(matchParent, matchParent)
|
|
|
- )
|
|
|
- }
|
|
|
- }
|
|
|
- 2 -> {
|
|
|
- return spotReportUI.root.apply {//现货报表
|
|
|
- container.addView(
|
|
|
- this,
|
|
|
- ViewGroup.LayoutParams(matchParent, matchParent)
|
|
|
- )
|
|
|
- }
|
|
|
- }
|
|
|
- 3 -> {
|
|
|
- return invertoryReportUI.root.apply {//库存报表 (品类)
|
|
|
- container.addView(
|
|
|
- this,
|
|
|
- ViewGroup.LayoutParams(matchParent, matchParent)
|
|
|
- )
|
|
|
- }
|
|
|
- }
|
|
|
- 4 -> {
|
|
|
- return invertoryWarehouseReportUI.root.apply {//库存报表 (仓库)
|
|
|
- container.addView(
|
|
|
- this,
|
|
|
- ViewGroup.LayoutParams(matchParent, matchParent)
|
|
|
- )
|
|
|
- }
|
|
|
- }
|
|
|
- 5 -> {
|
|
|
- return spotEarningReportUI.root.apply {//现货损益报表
|
|
|
- container.addView(
|
|
|
- this,
|
|
|
- ViewGroup.LayoutParams(matchParent, matchParent)
|
|
|
- )
|
|
|
- }
|
|
|
- }
|
|
|
- else -> return super.instantiateItem(container, position)
|
|
|
+ return uiList.get(position).apply {
|
|
|
+ container.addView(
|
|
|
+ this,
|
|
|
+ ViewGroup.LayoutParams(matchParent, matchParent)
|
|
|
+ )
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -140,27 +129,27 @@ class ReportQueryActivity : BaseActivity<ReportQueryViewModel>() {
|
|
|
|
|
|
override fun isViewFromObject(view: View, `object`: Any): Boolean = view == `object`
|
|
|
|
|
|
- override fun getCount(): Int = tabsArray.size
|
|
|
+ override fun getCount(): Int = newTabsArray.size
|
|
|
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- private val dialog by lazy { createLoadingDialog(hintStr = "请求中...") }
|
|
|
+ }
|
|
|
|
|
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
|
super.onCreate(savedInstanceState)
|
|
|
verticalLayout {
|
|
|
dialog.bindTaskStatus(context, viewModel.loadingDialogStatus)
|
|
|
+ initMenuData()
|
|
|
topBar {
|
|
|
commonLeftButton()
|
|
|
commonTitle {
|
|
|
text = "报表查询"
|
|
|
}
|
|
|
- commonMenuButton(R.mipmap.rma_search) {
|
|
|
- val intent = Intent()
|
|
|
- intent.setClass(context, InvoiceRegisterActivity::class.java)
|
|
|
- ActivityUtils.startActivity(intent)
|
|
|
- }
|
|
|
+// commonMenuButton(R.mipmap.rma_search) {
|
|
|
+// val intent = Intent()
|
|
|
+// intent.setClass(context, InvoiceRegisterActivity::class.java)
|
|
|
+// ActivityUtils.startActivity(intent)
|
|
|
+// }
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -176,6 +165,14 @@ class ReportQueryActivity : BaseActivity<ReportQueryViewModel>() {
|
|
|
selectedTabIndex = index
|
|
|
}
|
|
|
})
|
|
|
+
|
|
|
+// showIndex.bindOptional(context){
|
|
|
+// if (it ?: 0 > 5){
|
|
|
+// mode = QMUITabSegment.MODE_SCROLLABLE
|
|
|
+// }else{
|
|
|
+// mode = QMUITabSegment.MODE_FIXED
|
|
|
+// }
|
|
|
+// }
|
|
|
mode = QMUITabSegment.MODE_SCROLLABLE
|
|
|
setIndicator(QMUITabIndicator(QMUIDisplayHelper.dp2px(context, 2), false, true))
|
|
|
setDefaultTextSize(ConvertUtils.sp2px(16f), ConvertUtils.sp2px(16f))
|
|
|
@@ -191,7 +188,7 @@ class ReportQueryActivity : BaseActivity<ReportQueryViewModel>() {
|
|
|
viewPager {
|
|
|
background = resources.getDrawable(R.color.white)
|
|
|
viewPager = this
|
|
|
- adapter = pagerAdapter
|
|
|
+ adapter = newPagerAdapter
|
|
|
}.lparams(matchParent, matchParent)
|
|
|
|
|
|
segment.setupWithViewPager(viewPager)
|
|
|
@@ -923,7 +920,7 @@ class SpotReportUI(
|
|
|
}.lparams(matchParent, autoSize(100))
|
|
|
|
|
|
// viewModel.queryTitle(tableKey = Constant.table_mobile_report_expose, cycletime = tradedate.replace("-", ""),cycletype = "",userid = selectTransactionUser.value?.id ?: "",querytype = "1")
|
|
|
-
|
|
|
+ contentAdapter.setOnContentScrollListener(this@SpotReportUI)
|
|
|
linearLayout {
|
|
|
linearLayout {
|
|
|
gravity = Gravity.LEFT or Gravity.CENTER_VERTICAL
|
|
|
@@ -1204,7 +1201,7 @@ class SpotEarningReportUI(
|
|
|
}.lparams(matchParent, autoSize(100))
|
|
|
|
|
|
// viewModel.queryTitle(tableKey = Constant.table_mobile_report_expose, cycletime = tradedate.replace("-", ""),cycletype = "",userid = selectTransactionUser.value?.id ?: "",querytype = "1")
|
|
|
-
|
|
|
+ contentAdapter.setOnContentScrollListener(this@SpotEarningReportUI)
|
|
|
linearLayout {
|
|
|
linearLayout {
|
|
|
gravity = Gravity.LEFT or Gravity.CENTER_VERTICAL
|
|
|
@@ -1348,10 +1345,10 @@ class InvertoryReportUI(
|
|
|
}
|
|
|
|
|
|
/** 选择的现货品种 */
|
|
|
- private val selectdeliverygoodsData: MutableLiveData<SelectData> = MutableLiveData<SelectData>().apply { value = SelectData(id = "",value = "") }
|
|
|
+ private val selectdeliverygoodsData: MutableLiveData<SelectData> = MutableLiveData<SelectData>().apply { value = SelectData(id = "",value = "全部现货品种") }
|
|
|
|
|
|
/** 选择的型号类型/品类 **/
|
|
|
- private val selectWrStandModel: MutableLiveData<SelectData> = MutableLiveData<SelectData>().apply { value = SelectData(id = "",value = "") }
|
|
|
+ private val selectWrStandModel: MutableLiveData<SelectData> = MutableLiveData<SelectData>().apply { value = SelectData(id = "",value = "全部品类") }
|
|
|
|
|
|
/**
|
|
|
* 选择的报表周期类型
|
|
|
@@ -1721,13 +1718,13 @@ class InvertoryWarehouseReportUI(
|
|
|
}
|
|
|
|
|
|
/** 选择的现货品种 */
|
|
|
- private val selectdeliverygoodsData: MutableLiveData<SelectData> = MutableLiveData<SelectData>().apply { value = SelectData(id = "",value = "") }
|
|
|
+ private val selectdeliverygoodsData: MutableLiveData<SelectData> = MutableLiveData<SelectData>().apply { value = SelectData(id = "",value = "全部现货品种") }
|
|
|
|
|
|
/** 选择的型号类型/品类 **/
|
|
|
- private val selectWrStandModel: MutableLiveData<SelectData> = MutableLiveData<SelectData>().apply { value = SelectData(id = "",value = "") }
|
|
|
+ private val selectWrStandModel: MutableLiveData<SelectData> = MutableLiveData<SelectData>().apply { value = SelectData(id = "",value = "全部品类") }
|
|
|
|
|
|
/** 选择的仓库 **/
|
|
|
- private val selectWareHouse: MutableLiveData<SelectData> = MutableLiveData<SelectData>().apply { value = SelectData(id = "",value = "") }
|
|
|
+ private val selectWareHouse: MutableLiveData<SelectData> = MutableLiveData<SelectData>().apply { value = SelectData(id = "",value = "全部仓库") }
|
|
|
|
|
|
/**
|
|
|
* 选择的报表周期类型
|