|
|
@@ -371,6 +371,7 @@ class JobExecuteFragment : BaseFragment<FragmentJobExecuteBinding>() {
|
|
|
.observe(this) {
|
|
|
if (it) {
|
|
|
PopTip.tip(R.string.colock_complete)
|
|
|
+ checkStepComplete()
|
|
|
} else {
|
|
|
PopTip.tip(R.string.colock_failed)
|
|
|
}
|
|
|
@@ -387,6 +388,7 @@ class JobExecuteFragment : BaseFragment<FragmentJobExecuteBinding>() {
|
|
|
.observe(this) {
|
|
|
if (it) {
|
|
|
PopTip.tip(R.string.uncolock_complete)
|
|
|
+ checkStepComplete()
|
|
|
} else {
|
|
|
PopTip.tip(R.string.uncolock_failed)
|
|
|
}
|
|
|
@@ -423,6 +425,26 @@ class JobExecuteFragment : BaseFragment<FragmentJobExecuteBinding>() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 检查流程是否完成
|
|
|
+ */
|
|
|
+ private fun checkStepComplete() {
|
|
|
+ val workflowStep =
|
|
|
+ viewModel.workflowSteps.find { it.stepId == viewModel.currentStepData?.workflowStepId }
|
|
|
+ if (viewModel.stepConditionsComplete(workflowStep)) {
|
|
|
+ viewModel.currentStepData?.let {
|
|
|
+ viewModel.updateStepStatus(it).observe(this@JobExecuteFragment) {
|
|
|
+ if (it == false) {
|
|
|
+ PopTip.tip(R.string.step_confirm_failed)
|
|
|
+ } else {
|
|
|
+ checkCurrentStep()
|
|
|
+ }
|
|
|
+ binding.stepRv.adapter?.notifyDataSetChanged()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 检查当前步骤要显示的界面
|
|
|
*/
|
|
|
@@ -558,13 +580,22 @@ class JobExecuteFragment : BaseFragment<FragmentJobExecuteBinding>() {
|
|
|
workflowStep.confirmRoleCode.toString()
|
|
|
) == true) || (workflowStep.confirmRoleCode != null && MainDomainData.roleKeys?.contains(
|
|
|
workflowStep.confirmRoleCode.toString()
|
|
|
- ) == true && workflowStep.confirmUser != null && MainDomainData.userInfo?.userId == workflowStep.confirmUser)) && (workflowStep?.enableSetLocker == true || workflowStep?.enableSetColocker == true)
|
|
|
+ ) == true && workflowStep.confirmUser != null && MainDomainData.userInfo?.userId == workflowStep.confirmUser)) &&
|
|
|
+ (workflowStep?.enableSetLocker == true || workflowStep?.enableSetColocker == true)
|
|
|
) {
|
|
|
viewModel.currentStepData?.stepStatus = "1"
|
|
|
viewModel.currentStepData =
|
|
|
viewModel.ticketStep.firstOrNull { it.stepStatus == "0" }
|
|
|
- checkCurrentStep()
|
|
|
- binding.stepRv.adapter?.notifyDataSetChanged()
|
|
|
+ viewModel.currentStepData?.let {
|
|
|
+ viewModel.updateStepStatus(it).observe(this@JobExecuteFragment) {
|
|
|
+ if (it == false) {
|
|
|
+ PopTip.tip(R.string.step_confirm_failed)
|
|
|
+ } else {
|
|
|
+ checkCurrentStep()
|
|
|
+ }
|
|
|
+ binding.stepRv.adapter?.notifyDataSetChanged()
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
if (workflowStep?.enableAddColocker == true || workflowStep?.enableReduceColocker == true) {
|
|
|
if (workflowStep.gotoStepAfterAddingColocker != null) {
|
|
|
@@ -573,6 +604,14 @@ class JobExecuteFragment : BaseFragment<FragmentJobExecuteBinding>() {
|
|
|
.map { it.stepId }
|
|
|
}.forEach {
|
|
|
it.stepStatus = "0"
|
|
|
+ viewModel.updateStepStatus(it).observe(this@JobExecuteFragment) {
|
|
|
+ if (it == false) {
|
|
|
+ PopTip.tip(R.string.step_confirm_failed)
|
|
|
+ } else {
|
|
|
+ checkCurrentStep()
|
|
|
+ }
|
|
|
+ binding.stepRv.adapter?.notifyDataSetChanged()
|
|
|
+ }
|
|
|
}
|
|
|
viewModel.currentStepData =
|
|
|
viewModel.ticketStep.firstOrNull { it.stepStatus == "0" }
|