|
@@ -0,0 +1,121 @@
|
|
|
|
|
+package cn.muchinfo.rma.view.base.home.rolemanagement
|
|
|
|
|
+
|
|
|
|
|
+import android.content.Intent
|
|
|
|
|
+import android.os.Bundle
|
|
|
|
|
+import android.view.Gravity
|
|
|
|
|
+import cn.muchinfo.rma.R
|
|
|
|
|
+import cn.muchinfo.rma.global.data.AccMgrRoleData
|
|
|
|
|
+import cn.muchinfo.rma.lifecycle.bindOptional
|
|
|
|
|
+import cn.muchinfo.rma.view.autoWidget.*
|
|
|
|
|
+import cn.muchinfo.rma.view.base.BaseActivity
|
|
|
|
|
+import com.blankj.utilcode.util.ActivityUtils
|
|
|
|
|
+import mtp.polymer.com.autowidget.adapter.BaseAdapter
|
|
|
|
|
+import org.jetbrains.anko.linearLayout
|
|
|
|
|
+import org.jetbrains.anko.matchParent
|
|
|
|
|
+import org.jetbrains.anko.textView
|
|
|
|
|
+import org.jetbrains.anko.verticalLayout
|
|
|
|
|
+
|
|
|
|
|
+/**
|
|
|
|
|
+ * 角色设置页面
|
|
|
|
|
+ * @property swipeToLayout SwipeToLoadLayout
|
|
|
|
|
+ * @property statusLayout StatusLayout
|
|
|
|
|
+ * @property unSubmitAdapter BaseAdapter<WarehouseInfoData, WarehouseInformationViewHolder>
|
|
|
|
|
+ */
|
|
|
|
|
+class RoleSetActivity : BaseActivity<RoleSetViewModel>() {
|
|
|
|
|
+
|
|
|
|
|
+ // 下拉刷新
|
|
|
|
|
+ private lateinit var swipeToLayout: SwipeToLoadLayout
|
|
|
|
|
+ private lateinit var statusLayout: StatusLayout
|
|
|
|
|
+
|
|
|
|
|
+ private val roleSetAdapter: BaseAdapter<AccMgrRoleData, RoleSetViewHolder> =
|
|
|
|
|
+ BaseAdapter { _, _ -> RoleSetViewHolder(this, viewModel) }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ override fun onCreate(savedInstanceState: Bundle?) {
|
|
|
|
|
+ super.onCreate(savedInstanceState)
|
|
|
|
|
+ verticalLayout {
|
|
|
|
|
+ viewModel.queryAccMgrRole()
|
|
|
|
|
+ background = resources.getDrawable(R.color.main_hit_bg_color)
|
|
|
|
|
+ //页面标题
|
|
|
|
|
+ topBar {
|
|
|
|
|
+ commonLeftButton()
|
|
|
|
|
+ commonTitle {
|
|
|
|
|
+ text = "角色设置"
|
|
|
|
|
+ }
|
|
|
|
|
+ // 新增角色设置
|
|
|
|
|
+ commonMenuButton(R.mipmap.add_new) {
|
|
|
|
|
+ val intent = Intent()
|
|
|
|
|
+ intent.setClass(context,AddRoleSetActivity::class.java)
|
|
|
|
|
+ ActivityUtils.startActivity(intent)
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ linearLayout {
|
|
|
|
|
+ textView {
|
|
|
|
|
+ gravity = Gravity.CENTER
|
|
|
|
|
+ text = "角色名称"
|
|
|
|
|
+ textSizeAuto = 30
|
|
|
|
|
+ textColorInt = R.color.rma_hint_title_text_color
|
|
|
|
|
+ }.lparams(autoSize(200), autoSize(100))
|
|
|
|
|
+ textView {
|
|
|
|
|
+ gravity = Gravity.CENTER
|
|
|
|
|
+ text = "创建人"
|
|
|
|
|
+ textSizeAuto = 30
|
|
|
|
|
+ textColorInt = R.color.rma_hint_title_text_color
|
|
|
|
|
+ }.lparams(autoSize(200), autoSize(100))
|
|
|
|
|
+ textView {
|
|
|
|
|
+ gravity = Gravity.CENTER
|
|
|
|
|
+ text = "创建时间"
|
|
|
|
|
+ textSizeAuto = 30
|
|
|
|
|
+ textColorInt = R.color.rma_hint_title_text_color
|
|
|
|
|
+ }.lparams(autoSize(350), autoSize(100))
|
|
|
|
|
+ textView {
|
|
|
|
|
+ gravity = Gravity.CENTER
|
|
|
|
|
+ text = "状态"
|
|
|
|
|
+ textSizeAuto = 30
|
|
|
|
|
+ textColorInt = R.color.rma_hint_title_text_color
|
|
|
|
|
+ }.lparams(autoSize(150), autoSize(100))
|
|
|
|
|
+ }.lparams(matchParent, autoSize(100))
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ statusLayout(contentBlock = {
|
|
|
|
|
+ statusLayout = this
|
|
|
|
|
+// bindTaskStatus(viewModule.status)
|
|
|
|
|
+ setRetryAction {
|
|
|
|
|
+ viewModel.queryAccMgrRole()
|
|
|
|
|
+ }
|
|
|
|
|
+ swipeToLoadLayout {
|
|
|
|
|
+ swipeToLayout = this
|
|
|
|
|
+ setEnableRefresh(true)
|
|
|
|
|
+ setEnableLoadMore(false)
|
|
|
|
|
+ setOnRefreshListener {
|
|
|
|
|
+ viewModel.queryAccMgrRole()
|
|
|
|
|
+ }
|
|
|
|
|
+ setEnableScrollContentWhenLoaded(false)
|
|
|
|
|
+ setEnableLoadMoreWhenContentNotFull(false)
|
|
|
|
|
+
|
|
|
|
|
+ // 未提交列表
|
|
|
|
|
+ recyclerView {
|
|
|
|
|
+ background = resources.getDrawable(R.color.white)
|
|
|
|
|
+ adapter = roleSetAdapter
|
|
|
|
|
+ }.lparams(matchParent, matchParent)
|
|
|
|
|
+ }
|
|
|
|
|
+ }, emptyBlock = {
|
|
|
|
|
+ emptyView(hint = resources.getString(R.string.now_no_data))
|
|
|
|
|
+ }).lparams(matchParent, matchParent)
|
|
|
|
|
+
|
|
|
|
|
+ viewModel.roleSetDataList.bindOptional(context) {
|
|
|
|
|
+ if (it?.isEmpty() == true || it?.size == 0) {
|
|
|
|
|
+ statusLayout.showEmpty()
|
|
|
|
|
+ } else {
|
|
|
|
|
+ if (swipeToLayout.getIsRefreshing()) {
|
|
|
|
|
+ swipeToLayout.finishRefresh()
|
|
|
|
|
+ }
|
|
|
|
|
+ statusLayout.showSuccess()
|
|
|
|
|
+ roleSetAdapter.setNewData(it)
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+}
|