|
|
@@ -50,7 +50,9 @@ data class Node(
|
|
|
* 校验是否可以通过手机进行操作
|
|
|
*/
|
|
|
fun checkCanOptionByPhone(): Boolean {
|
|
|
- return !(listOf("lock", "unlock", "coLock","unlockCoLock").contains(type) && !listOf("0", "2").contains(isolationType))
|
|
|
+ return !(listOf("lock", "unlock", "coLock", "unlockCoLock").contains(type) && !listOf("0", "2").contains(
|
|
|
+ isolationType
|
|
|
+ ))
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -88,7 +90,7 @@ data class Node(
|
|
|
params["formId"] = formId.toInt()
|
|
|
params["formData"] = formData
|
|
|
// 处理隔离点信息表单
|
|
|
- if (listOf("isolation", "releaseIsolation").contains(type)) {
|
|
|
+ if (listOf("lock", "unlock").contains(type)) {
|
|
|
val isolationType = forms.find { it.name == "isolationType" }?.value?.getOrNull(0) ?: "-1"
|
|
|
val isolationPoints = forms.find { it.name == "isolationPoints" }?.value ?: emptyList()
|
|
|
if (isolationType == "1") {
|
|
|
@@ -108,7 +110,7 @@ data class Node(
|
|
|
postfix = "]",
|
|
|
separator = ","
|
|
|
)
|
|
|
- if (type == "releaseIsolation") {
|
|
|
+ if (type == "unlock") {
|
|
|
val isolationNode = forms.find { it.name == "isolationNode" }?.value?.getOrNull(0)
|
|
|
// 解除隔离,这里需要填写关联的节点uuid
|
|
|
params["isolationNodeUuid"] = isolationNode
|
|
|
@@ -156,7 +158,7 @@ data class Node(
|
|
|
// 解析隔离节点
|
|
|
val isolationNode = forms.find { it.name == "isolationNode" }?.value?.getOrNull(0)
|
|
|
// 如果是解除隔离操作,隔离方式、隔离点位、负责人(或者上锁人、解锁人)需要从选中的点位中获取
|
|
|
- if (type == "releaseIsolation") {
|
|
|
+ if (type == "unlock") {
|
|
|
nodes.find { it.node?.uuid == isolationNode }?.node?.let {
|
|
|
// 从节点中将数据copy到当前节点
|
|
|
workerUserId = "${it.workerUserId}"
|
|
|
@@ -255,29 +257,29 @@ data class Node(
|
|
|
value = if (workerUserId > 0) listOf(workerUserId.toString()) else listOf()
|
|
|
)
|
|
|
// 添加业务表单
|
|
|
- list += FormField(
|
|
|
- id.toString(),
|
|
|
- "select",
|
|
|
- "业务表单",
|
|
|
- name = "formId",
|
|
|
- true,
|
|
|
- placeholder = listOf("请选择业务表单"),
|
|
|
- options = workFormList.map { FormOption(it.name ?: "", it.id.toString()) },
|
|
|
- value = if (formId > 0) listOf(formId.toString()) else listOf()
|
|
|
- )
|
|
|
+// list += FormField(
|
|
|
+// id.toString(),
|
|
|
+// "select",
|
|
|
+// "业务表单",
|
|
|
+// name = "formId",
|
|
|
+// true,
|
|
|
+// placeholder = listOf("请选择业务表单"),
|
|
|
+// options = workFormList.map { FormOption(it.name ?: "", it.id.toString()) },
|
|
|
+// value = if (formId > 0) listOf(formId.toString()) else listOf()
|
|
|
+// )
|
|
|
// 隔离配置
|
|
|
- if (listOf("isolation", "releaseIsolation").contains(type)) {
|
|
|
+ if (listOf("lock", "unlock", "coLock", "unlockCoLock").contains(type)) {
|
|
|
// 先移除负责人,需要在后面进行添加
|
|
|
list.removeIf { it.name == "workerUserId" }
|
|
|
// 而且业务表单非必填
|
|
|
val formField = list.find { it.name == "formId" }?.copy(required = false)
|
|
|
list.removeIf { it.name == "formId" }
|
|
|
formField?.let { list.add(it) }
|
|
|
- val isolations = nodes.map { it.node }.filter { it != null && it.type == "isolation" }
|
|
|
+ val isolations = nodes.map { it.node }.filter { it != null && it.type == "lock" }
|
|
|
var enabled = true
|
|
|
var isLockerTemp = isLocker
|
|
|
// 如果是解除隔离操作,这里只能选择当前流程中已经存在的隔离点位
|
|
|
- if (type == "releaseIsolation") {
|
|
|
+ if (type == "unlock") {
|
|
|
enabled = false
|
|
|
// 增加隔离点选择列表
|
|
|
list += FormField(
|
|
|
@@ -292,90 +294,88 @@ data class Node(
|
|
|
)
|
|
|
// 如果是解除隔离的操作,这里需要先校验选择的节点是否是拆除
|
|
|
isLockerTemp = isolationType == "1"
|
|
|
- }
|
|
|
+ } else if (type == "coLock" || type == "unlockCoLock") isLockerTemp = true
|
|
|
// 抽取隔离方式value值
|
|
|
val valueOfIsolationType = if (isolationType.isNullOrEmpty()) {
|
|
|
listOf()
|
|
|
// val type = dataMap["isolationMethod"]
|
|
|
// if (type == null) listOf() else listOf("$type")
|
|
|
} else listOf(isolationType)
|
|
|
- // 隔离方式
|
|
|
- list += FormField(
|
|
|
- id.toString(),
|
|
|
- "select",
|
|
|
- "隔离方式",
|
|
|
- "isolationType",
|
|
|
- true,
|
|
|
- placeholder = listOf("请选择隔离方式"),
|
|
|
- options = isolationMethodList.map { FormOption(it.label, it.value) },
|
|
|
- value = valueOfIsolationType,
|
|
|
- enabled = enabled
|
|
|
- )
|
|
|
- // 抽取隔离点位value值
|
|
|
- val points = if (isolationPoints.isNullOrEmpty()) "" else isolationPoints.replace("[", "").replace("]", "")
|
|
|
- val valueOfIsolationPoints = if (points.isNotEmpty()) {
|
|
|
- points.split(",")
|
|
|
- } else {
|
|
|
- listOf()
|
|
|
-// when (val value = dataMap["isolationPoints"]) {
|
|
|
-// // 如果是数组
|
|
|
-// is List<*> -> value.map { "$it".toFloat().toInt().toString() }
|
|
|
-// // 如果是String
|
|
|
-// is String -> {
|
|
|
-// value.replace("[", "").replace("]", "").split(",")
|
|
|
-// }
|
|
|
-// // 其他不处理
|
|
|
-// else -> listOf()
|
|
|
-// }
|
|
|
- }
|
|
|
- // 隔离点选择,可多选
|
|
|
- list += FormField(
|
|
|
- id.toString(),
|
|
|
- "select",
|
|
|
- "隔离点选择(可多选)",
|
|
|
- "isolationPoints",
|
|
|
- true,
|
|
|
- listOf("请选择隔离点"),
|
|
|
- multiSelect = true,
|
|
|
- options = isolationList.map { FormOption(it.pointName ?: "", it.id.toString()) },
|
|
|
- value = valueOfIsolationPoints,
|
|
|
- enabled = enabled
|
|
|
- )
|
|
|
- if (isLockerTemp) {
|
|
|
- var locker = nodeUserList?.find { it.type == "jtlocker" }
|
|
|
- var group = nodeUserList?.filter { it.type == "jtcolocker" } ?: emptyList()
|
|
|
- // 如果是解除隔离,且当前解锁和工作人列表为空,需要默认配置
|
|
|
- if (type == "releaseIsolation" && nodeUserList.isNullOrEmpty()) {
|
|
|
- val bindNode = nodes.find { it.node?.uuid == isolationNodeUuid && !isolationNodeUuid.isNullOrEmpty() }
|
|
|
- val nodeUserList = bindNode?.node?.nodeUserList
|
|
|
- locker = nodeUserList?.find { it.type == "jtlocker" }
|
|
|
- group = nodeUserList?.filter { it.type == "jtcolocker" } ?: emptyList()
|
|
|
- }
|
|
|
- // 上锁人
|
|
|
+ if (listOf("lock", "unlock").contains(type)) {
|
|
|
+ // 隔离方式
|
|
|
list += FormField(
|
|
|
id.toString(),
|
|
|
"select",
|
|
|
- "上锁人",
|
|
|
- "locker",
|
|
|
+ "隔离方式",
|
|
|
+ "isolationType",
|
|
|
true,
|
|
|
- placeholder = listOf("请选择上锁人"),
|
|
|
- options = lockerUserList.map { FormOption(it.nickname, it.id.toString()) },
|
|
|
- value = if (locker != null) listOf(locker.userId.toString()) else listOf(),
|
|
|
+ placeholder = listOf("请选择隔离方式"),
|
|
|
+ options = isolationMethodList.map { FormOption(it.label, it.value) },
|
|
|
+ value = valueOfIsolationType,
|
|
|
enabled = enabled
|
|
|
)
|
|
|
- // 共锁人
|
|
|
+
|
|
|
+ // 抽取隔离点位value值
|
|
|
+ val points =
|
|
|
+ if (isolationPoints.isNullOrEmpty()) "" else isolationPoints.replace("[", "").replace("]", "")
|
|
|
+ val valueOfIsolationPoints = if (points.isNotEmpty()) {
|
|
|
+ points.split(",")
|
|
|
+ } else {
|
|
|
+ listOf()
|
|
|
+ }
|
|
|
+ // 隔离点选择,可多选
|
|
|
list += FormField(
|
|
|
id.toString(),
|
|
|
"select",
|
|
|
- "共锁人(可多选)",
|
|
|
- "group",
|
|
|
- false,
|
|
|
- placeholder = listOf("请选择共锁人"),
|
|
|
- options = groupUserList.map { FormOption(it.nickname, it.id.toString()) },
|
|
|
- value = if (group.isNotEmpty()) group.map { it.userId.toString() } else listOf(),
|
|
|
+ "隔离点选择(可多选)",
|
|
|
+ "isolationPoints",
|
|
|
+ true,
|
|
|
+ listOf("请选择隔离点"),
|
|
|
multiSelect = true,
|
|
|
+ options = isolationList.map { FormOption(it.pointName ?: "", it.id.toString()) },
|
|
|
+ value = valueOfIsolationPoints,
|
|
|
enabled = enabled
|
|
|
)
|
|
|
+ }
|
|
|
+ if (isLockerTemp) {
|
|
|
+ var locker = nodeUserList?.find { it.type == "jtlocker" }
|
|
|
+ var group = nodeUserList?.filter { it.type == "jtcolocker" } ?: emptyList()
|
|
|
+ // 如果是解除隔离,且当前解锁和工作人列表为空,需要默认配置
|
|
|
+ if (type == "unlock" && nodeUserList.isNullOrEmpty()) {
|
|
|
+ val bindNode =
|
|
|
+ nodes.find { it.node?.uuid == isolationNodeUuid && !isolationNodeUuid.isNullOrEmpty() }
|
|
|
+ val nodeUserList = bindNode?.node?.nodeUserList
|
|
|
+ locker = nodeUserList?.find { it.type == "jtlocker" }
|
|
|
+ group = nodeUserList?.filter { it.type == "jtcolocker" } ?: emptyList()
|
|
|
+ }
|
|
|
+ if (listOf("lock", "unlock").contains(type)) {
|
|
|
+ // 上锁人
|
|
|
+ list += FormField(
|
|
|
+ id.toString(),
|
|
|
+ "select",
|
|
|
+ "上锁人",
|
|
|
+ "locker",
|
|
|
+ true,
|
|
|
+ placeholder = listOf("请选择上锁人"),
|
|
|
+ options = lockerUserList.map { FormOption(it.nickname, it.id.toString()) },
|
|
|
+ value = if (locker != null) listOf(locker.userId.toString()) else listOf(),
|
|
|
+ enabled = enabled
|
|
|
+ )
|
|
|
+ } else {
|
|
|
+ // 共锁人
|
|
|
+ list += FormField(
|
|
|
+ id.toString(),
|
|
|
+ "select",
|
|
|
+ "共锁人(可多选)",
|
|
|
+ "group",
|
|
|
+ true,
|
|
|
+ placeholder = listOf("请选择共锁人"),
|
|
|
+ options = groupUserList.map { FormOption(it.nickname, it.id.toString()) },
|
|
|
+ value = if (group.isNotEmpty()) group.map { it.userId.toString() } else listOf(),
|
|
|
+ multiSelect = true,
|
|
|
+ enabled = enabled
|
|
|
+ )
|
|
|
+ }
|
|
|
} else {
|
|
|
// 负责人
|
|
|
list += FormField(
|
|
|
@@ -441,13 +441,15 @@ data class Node(
|
|
|
// 录入信息
|
|
|
"inputInfo" -> R.drawable.node_icon_input_info
|
|
|
// 隔离
|
|
|
- "isolation" -> R.drawable.node_icon_isolation
|
|
|
+ "lock",
|
|
|
+ "coLock" -> R.drawable.node_icon_isolation
|
|
|
// 解除隔离
|
|
|
- "releaseIsolation" -> R.drawable.node_icon_release_isolation
|
|
|
+ "unlockCoLock" -> R.drawable.node_icon_release_isolation
|
|
|
// 还锁
|
|
|
- "returnLock" -> R.drawable.node_icon_return_lock
|
|
|
+ "unlock" -> R.drawable.node_icon_return_lock
|
|
|
// 结束
|
|
|
"complete" -> R.drawable.node_icon_complete
|
|
|
+ // 其它
|
|
|
else -> R.drawable.tips
|
|
|
}
|
|
|
}
|