|
@@ -10,6 +10,7 @@ import com.drake.brv.utils.divider
|
|
|
import com.drake.brv.utils.linear
|
|
import com.drake.brv.utils.linear
|
|
|
import com.drake.brv.utils.models
|
|
import com.drake.brv.utils.models
|
|
|
import com.drake.brv.utils.setup
|
|
import com.drake.brv.utils.setup
|
|
|
|
|
+import com.grkj.data.enums.RoleEnum
|
|
|
import com.grkj.data.model.vo.RoleManageVo
|
|
import com.grkj.data.model.vo.RoleManageVo
|
|
|
import com.grkj.iscs.R
|
|
import com.grkj.iscs.R
|
|
|
import com.grkj.iscs.databinding.FragmentRoleManageBinding
|
|
import com.grkj.iscs.databinding.FragmentRoleManageBinding
|
|
@@ -52,6 +53,20 @@ class RoleManageFragment : BaseFragment<FragmentRoleManageBinding>() {
|
|
|
getRoleData(nextPage = false)
|
|
getRoleData(nextPage = false)
|
|
|
}
|
|
}
|
|
|
addRoleDialog.setOnConfirmListener {
|
|
addRoleDialog.setOnConfirmListener {
|
|
|
|
|
+ if (it.roleKeys in RoleEnum.values().map { it.roleKey }) {
|
|
|
|
|
+ TipDialog.show(
|
|
|
|
|
+ title = CommonUtils.getStr(com.grkj.ui_base.R.string.action_failed)
|
|
|
|
|
+ .toString(),
|
|
|
|
|
+ dialogType = TipDialog.DialogType.ERROR,
|
|
|
|
|
+ msg = CommonUtils.getStr(R.string.role_key_already_exists).toString(),
|
|
|
|
|
+ countDownTime = 10,
|
|
|
|
|
+ showConfirm = false,
|
|
|
|
|
+ onCancelClick = {
|
|
|
|
|
+ getRoleData(nextPage = false)
|
|
|
|
|
+ }
|
|
|
|
|
+ )
|
|
|
|
|
+ return@setOnConfirmListener
|
|
|
|
|
+ }
|
|
|
viewModel.addRoleData(it).observe(this) {
|
|
viewModel.addRoleData(it).observe(this) {
|
|
|
if (it) {
|
|
if (it) {
|
|
|
TipDialog.show(
|
|
TipDialog.show(
|
|
@@ -81,6 +96,20 @@ class RoleManageFragment : BaseFragment<FragmentRoleManageBinding>() {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
updateRoleDialog.setOnConfirmListener {
|
|
updateRoleDialog.setOnConfirmListener {
|
|
|
|
|
+ if (it.roleKeys in RoleEnum.values().map { it.roleKey } && it.isPreset == false) {
|
|
|
|
|
+ TipDialog.show(
|
|
|
|
|
+ title = CommonUtils.getStr(com.grkj.ui_base.R.string.action_failed)
|
|
|
|
|
+ .toString(),
|
|
|
|
|
+ dialogType = TipDialog.DialogType.ERROR,
|
|
|
|
|
+ msg = CommonUtils.getStr(R.string.role_key_already_exists).toString(),
|
|
|
|
|
+ countDownTime = 10,
|
|
|
|
|
+ showConfirm = false,
|
|
|
|
|
+ onCancelClick = {
|
|
|
|
|
+ getRoleData(nextPage = false)
|
|
|
|
|
+ }
|
|
|
|
|
+ )
|
|
|
|
|
+ return@setOnConfirmListener
|
|
|
|
|
+ }
|
|
|
viewModel.updateRoleData(it).observe(this) {
|
|
viewModel.updateRoleData(it).observe(this) {
|
|
|
if (it) {
|
|
if (it) {
|
|
|
TipDialog.show(
|
|
TipDialog.show(
|
|
@@ -172,6 +201,7 @@ class RoleManageFragment : BaseFragment<FragmentRoleManageBinding>() {
|
|
|
roleKeys = item.roleKey.toString()
|
|
roleKeys = item.roleKey.toString()
|
|
|
status = item.status == "0"
|
|
status = item.status == "0"
|
|
|
functionalPermissions = it
|
|
functionalPermissions = it
|
|
|
|
|
+ isPreset = item.roleKey in RoleEnum.values().map { it.roleKey }
|
|
|
})
|
|
})
|
|
|
updateRoleDialog.showPopupWindow()
|
|
updateRoleDialog.showPopupWindow()
|
|
|
}
|
|
}
|