Browse Source

1. 补充commonadmin公共管理员可创建作业的权限

bjb 1 month ago
parent
commit
f5585514f4

+ 9 - 2
app/src/main/java/com/iscs/bozzys/api/Node.kt

@@ -339,8 +339,15 @@ data class Node(
                 enabled = enabled
             )
             if (isLockerTemp) {
-                val locker = nodeUserList?.find { it.type == "jtlocker" }
-                val group = nodeUserList?.filter { it.type == "jtcolocker" } ?: emptyList()
+                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()
+                }
                 // 上锁人
                 list += FormField(
                     id.toString(),

+ 1 - 1
app/src/main/java/com/iscs/bozzys/ui/pages/create/job/PageCreateJob.kt

@@ -73,7 +73,7 @@ class PageCreateJob : PageBase() {
                 // 表单内容
                 if (state.forms.isNotEmpty()) CardBox(Modifier.padding(horizontal = 16.dp, vertical = 16.dp)) {
                     FormBox(
-                        state.forms, {}, modifier = Modifier
+                        state.forms, { vm.onFormValueChanged(it) }, modifier = Modifier
                             .padding(horizontal = 10.dp)
                             .padding(top = 5.dp, bottom = 16.dp)
                     )

+ 19 - 0
app/src/main/java/com/iscs/bozzys/ui/pages/vm/VMCreateJob.kt

@@ -63,6 +63,25 @@ class VMCreateJob : VMBase() {
         }
     }
 
+    /**
+     * 表单数据发生变化
+     *
+     * @param form  sop名称发生变化同步更新作业名称和作业内容
+     */
+    fun onFormValueChanged(form: FormField) {
+//        val value = form.options.find { it.value == form.value.getOrNull(0) }?.label
+//        if (form.id == "job_sop" && !value.isNullOrEmpty()) {
+//            val forms = _state.value.forms.map { f ->
+//                when (f.id) {
+//                    "job_name" -> f.copy(value = listOf(value))
+//                    "job_content" -> f.copy(value = listOf(value))
+//                    else -> f
+//                }
+//            }
+//            _state.value = _state.value.copy(forms = forms)
+//        }
+    }
+
     /**
      * 创建作业操作
      */