Pārlūkot izejas kodu

1. 修改适配解除共锁需要选择,不能自己选择人员需要关联共锁流程

bjb 1 nedēļu atpakaļ
vecāks
revīzija
41e25531fd

+ 7 - 0
.idea/deploymentTargetSelector.xml

@@ -4,6 +4,13 @@
     <selectionStates>
       <SelectionState runConfigName="app">
         <option name="selectionMode" value="DROPDOWN" />
+        <DropdownSelection timestamp="2026-05-13T08:27:08.970350Z">
+          <Target type="DEFAULT_BOOT">
+            <handle>
+              <DeviceId pluginId="Default" identifier="serial=192.168.43.107:5555;connection=feb98c02" />
+            </handle>
+          </Target>
+        </DropdownSelection>
         <DialogSelection />
       </SelectionState>
     </selectionStates>

+ 45 - 13
app/src/main/java/com/iscs/bozzys/api/Node.kt

@@ -90,26 +90,37 @@ data class Node(
             params["formId"] = formId.toInt()
             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 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")
-                    // 上锁人和共锁人
-                    val locker = forms.find { it.name == "locker" }?.value?.getOrNull(0) ?: "-1"
+                    // 共锁人
                     val group = forms.find { it.name == "group" }?.value ?: emptyList()
                     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") }
                     params["nodeUserDOList"] = userList
                 }
-                params["isolationType"] = isolationType
-                params["isolationPoints"] = isolationPoints.joinToString(
-                    prefix = "[",
-                    postfix = "]",
-                    separator = ","
-                )
                 if (type == "unlock") {
                     val isolationNode = forms.find { it.name == "isolationNode" }?.value?.getOrNull(0)
                     // 解除隔离,这里需要填写关联的节点uuid
@@ -170,6 +181,10 @@ data class Node(
                     }
                     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()
@@ -294,7 +309,24 @@ data class Node(
                 )
                 // 如果是解除隔离的操作,这里需要先校验选择的节点是否是拆除
                 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值
             val valueOfIsolationType = if (isolationType.isNullOrEmpty()) {
                 listOf()
@@ -341,7 +373,7 @@ data class Node(
                 var locker = nodeUserList?.find { it.type == "jtlocker" }
                 var group = nodeUserList?.filter { it.type == "jtcolocker" } ?: emptyList()
                 // 如果是解除隔离,且当前解锁和工作人列表为空,需要默认配置
-                if (type == "unlock" && nodeUserList.isNullOrEmpty()) {
+                if (listOf("unlock", "unlockCoLock").contains(type) && nodeUserList.isNullOrEmpty()) {
                     val bindNode =
                         nodes.find { it.node?.uuid == isolationNodeUuid && !isolationNodeUuid.isNullOrEmpty() }
                     val nodeUserList = bindNode?.node?.nodeUserList