|
@@ -90,26 +90,37 @@ data class Node(
|
|
|
params["formId"] = formId.toInt()
|
|
params["formId"] = formId.toInt()
|
|
|
params["formData"] = formData
|
|
params["formData"] = formData
|
|
|
// 处理隔离点信息表单
|
|
// 处理隔离点信息表单
|
|
|
- if (listOf("lock", "unlock").contains(type)) {
|
|
|
|
|
|
|
+ if (listOf("lock", "unlock", "coLock", "unlockCoLock").contains(type)) {
|
|
|
val isolationType = forms.find { it.name == "isolationType" }?.value?.getOrNull(0) ?: "-1"
|
|
val isolationType = forms.find { it.name == "isolationType" }?.value?.getOrNull(0) ?: "-1"
|
|
|
val isolationPoints = forms.find { it.name == "isolationPoints" }?.value ?: emptyList()
|
|
val isolationPoints = forms.find { it.name == "isolationPoints" }?.value ?: emptyList()
|
|
|
- if (isolationType == "1") {
|
|
|
|
|
|
|
+ if (listOf("lock", "unlock").contains(type)) {
|
|
|
|
|
+ if (isolationType == "1") {
|
|
|
|
|
+ // 移除负责人
|
|
|
|
|
+ params.remove("workerUserId")
|
|
|
|
|
+ // 上锁人
|
|
|
|
|
+ val locker = forms.find { it.name == "locker" }?.value?.getOrNull(0) ?: "-1"
|
|
|
|
|
+ val userList = mutableListOf<MutableMap<String, Any>>()
|
|
|
|
|
+ if (locker.toInt() > 0) userList += mutableMapOf(
|
|
|
|
|
+ "userId" to locker.toInt(),
|
|
|
|
|
+ "type" to "jtlocker"
|
|
|
|
|
+ )
|
|
|
|
|
+ params["nodeUserDOList"] = userList
|
|
|
|
|
+ }
|
|
|
|
|
+ params["isolationType"] = isolationType
|
|
|
|
|
+ params["isolationPoints"] = isolationPoints.joinToString(
|
|
|
|
|
+ prefix = "[",
|
|
|
|
|
+ postfix = "]",
|
|
|
|
|
+ separator = ","
|
|
|
|
|
+ )
|
|
|
|
|
+ } else if (listOf("coLock", "unlockCoLock").contains(type)) {
|
|
|
// 移除负责人
|
|
// 移除负责人
|
|
|
params.remove("workerUserId")
|
|
params.remove("workerUserId")
|
|
|
- // 上锁人和共锁人
|
|
|
|
|
- val locker = forms.find { it.name == "locker" }?.value?.getOrNull(0) ?: "-1"
|
|
|
|
|
|
|
+ // 共锁人
|
|
|
val group = forms.find { it.name == "group" }?.value ?: emptyList()
|
|
val group = forms.find { it.name == "group" }?.value ?: emptyList()
|
|
|
val userList = mutableListOf<MutableMap<String, Any>>()
|
|
val userList = mutableListOf<MutableMap<String, Any>>()
|
|
|
- if (locker.toInt() > 0) userList += mutableMapOf("userId" to locker.toInt(), "type" to "jtlocker")
|
|
|
|
|
group.forEach { userList += mutableMapOf("userId" to it.toInt(), "type" to "jtcolocker") }
|
|
group.forEach { userList += mutableMapOf("userId" to it.toInt(), "type" to "jtcolocker") }
|
|
|
params["nodeUserDOList"] = userList
|
|
params["nodeUserDOList"] = userList
|
|
|
}
|
|
}
|
|
|
- params["isolationType"] = isolationType
|
|
|
|
|
- params["isolationPoints"] = isolationPoints.joinToString(
|
|
|
|
|
- prefix = "[",
|
|
|
|
|
- postfix = "]",
|
|
|
|
|
- separator = ","
|
|
|
|
|
- )
|
|
|
|
|
if (type == "unlock") {
|
|
if (type == "unlock") {
|
|
|
val isolationNode = forms.find { it.name == "isolationNode" }?.value?.getOrNull(0)
|
|
val isolationNode = forms.find { it.name == "isolationNode" }?.value?.getOrNull(0)
|
|
|
// 解除隔离,这里需要填写关联的节点uuid
|
|
// 解除隔离,这里需要填写关联的节点uuid
|
|
@@ -170,6 +181,10 @@ data class Node(
|
|
|
}
|
|
}
|
|
|
userList.addAll(it.nodeUserList ?: emptyList())
|
|
userList.addAll(it.nodeUserList ?: emptyList())
|
|
|
}
|
|
}
|
|
|
|
|
+ } else if (type == "unlockCoLock") {
|
|
|
|
|
+ nodes.find { it.node?.uuid == isolationNode }?.node?.let {
|
|
|
|
|
+ userList.addAll(it.nodeUserList ?: emptyList())
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
// 通知方式
|
|
// 通知方式
|
|
|
val noticeType = forms.find { it.name == "noticeType" }?.value ?: emptyList()
|
|
val noticeType = forms.find { it.name == "noticeType" }?.value ?: emptyList()
|
|
@@ -294,7 +309,24 @@ data class Node(
|
|
|
)
|
|
)
|
|
|
// 如果是解除隔离的操作,这里需要先校验选择的节点是否是拆除
|
|
// 如果是解除隔离的操作,这里需要先校验选择的节点是否是拆除
|
|
|
isLockerTemp = isolationType == "1"
|
|
isLockerTemp = isolationType == "1"
|
|
|
- } else if (type == "coLock" || type == "unlockCoLock") isLockerTemp = true
|
|
|
|
|
|
|
+ } else if (type == "coLock" || type == "unlockCoLock") {
|
|
|
|
|
+ if (type == "unlockCoLock") {
|
|
|
|
|
+ val isolations = nodes.map { it.node }.filter { it != null && it.type == "coLock" }
|
|
|
|
|
+ enabled = false
|
|
|
|
|
+ // 增加隔离点选择列表
|
|
|
|
|
+ list += FormField(
|
|
|
|
|
+ id.toString(),
|
|
|
|
|
+ type = "select",
|
|
|
|
|
+ label = "选择解除共锁节点",
|
|
|
|
|
+ name = "isolationNode",
|
|
|
|
|
+ required = true,
|
|
|
|
|
+ placeholder = listOf("请选择解除共锁节点"),
|
|
|
|
|
+ options = isolations.map { FormOption(it?.nodeName ?: "", value = it?.uuid ?: "") },
|
|
|
|
|
+ value = if (isolationNodeUuid.isNullOrEmpty()) listOf() else listOf(isolationNodeUuid)
|
|
|
|
|
+ )
|
|
|
|
|
+ }
|
|
|
|
|
+ isLockerTemp = true
|
|
|
|
|
+ }
|
|
|
// 抽取隔离方式value值
|
|
// 抽取隔离方式value值
|
|
|
val valueOfIsolationType = if (isolationType.isNullOrEmpty()) {
|
|
val valueOfIsolationType = if (isolationType.isNullOrEmpty()) {
|
|
|
listOf()
|
|
listOf()
|
|
@@ -341,7 +373,7 @@ data class Node(
|
|
|
var locker = nodeUserList?.find { it.type == "jtlocker" }
|
|
var locker = nodeUserList?.find { it.type == "jtlocker" }
|
|
|
var group = nodeUserList?.filter { it.type == "jtcolocker" } ?: emptyList()
|
|
var group = nodeUserList?.filter { it.type == "jtcolocker" } ?: emptyList()
|
|
|
// 如果是解除隔离,且当前解锁和工作人列表为空,需要默认配置
|
|
// 如果是解除隔离,且当前解锁和工作人列表为空,需要默认配置
|
|
|
- if (type == "unlock" && nodeUserList.isNullOrEmpty()) {
|
|
|
|
|
|
|
+ if (listOf("unlock", "unlockCoLock").contains(type) && nodeUserList.isNullOrEmpty()) {
|
|
|
val bindNode =
|
|
val bindNode =
|
|
|
nodes.find { it.node?.uuid == isolationNodeUuid && !isolationNodeUuid.isNullOrEmpty() }
|
|
nodes.find { it.node?.uuid == isolationNodeUuid && !isolationNodeUuid.isNullOrEmpty() }
|
|
|
val nodeUserList = bindNode?.node?.nodeUserList
|
|
val nodeUserList = bindNode?.node?.nodeUserList
|