|
@@ -22,7 +22,8 @@ class VMCreateJob : VMBase() {
|
|
|
val state = _state.asStateFlow()
|
|
val state = _state.asStateFlow()
|
|
|
|
|
|
|
|
// 表单基准数据
|
|
// 表单基准数据
|
|
|
- val json = "[{\"id\":\"job_name\",\"label\":\"作业名称\",\"value\":[\"\"],\"type\":\"input\",\"placeholder\":[\"请输入作业名称\"],\"required\":true},{\"id\":\"job_sop\",\"label\":\"流程模板\",\"value\":[\"\"],\"type\":\"select\",\"placeholder\":[\"\"],\"required\":true,\"options\":[]},{\"id\":\"job_type\",\"label\":\"作业分类\",\"value\":[\"\"],\"type\":\"select\",\"placeholder\":[\"\"],\"options\":[],\"required\":true},{\"id\":\"job_content\",\"label\":\"作业内容\",\"value\":[\"\"],\"type\":\"textarea\",\"placeholder\":[\"\"],\"required\":true},{\"id\":\"job_urgency_level\",\"label\":\"紧急程度\",\"value\":[\"0\"],\"type\":\"radio\",\"placeholder\":[\"\"],\"required\":false,\"options\":[{\"label\":\"普通\",\"value\":\"0\"},{\"label\":\"紧急\",\"value\":\"1\"},{\"label\":\"非常紧急\",\"value\":\"2\"}]}]"
|
|
|
|
|
|
|
+ val json =
|
|
|
|
|
+ "[{\"id\":\"job_name\",\"label\":\"作业名称\",\"value\":[\"\"],\"type\":\"input\",\"placeholder\":[\"请输入作业名称\"],\"required\":true},{\"id\":\"job_sop\",\"label\":\"流程模板\",\"value\":[\"\"],\"type\":\"select\",\"placeholder\":[\"\"],\"required\":true,\"options\":[]},{\"id\":\"job_type\",\"label\":\"作业分类\",\"value\":[\"\"],\"type\":\"select\",\"placeholder\":[\"\"],\"options\":[],\"required\":true},{\"id\":\"job_content\",\"label\":\"作业内容\",\"value\":[\"\"],\"type\":\"textarea\",\"placeholder\":[\"\"],\"required\":true},{\"id\":\"job_urgency_level\",\"label\":\"紧急程度\",\"value\":[\"0\"],\"type\":\"radio\",\"placeholder\":[\"\"],\"required\":false,\"options\":[{\"label\":\"普通\",\"value\":\"0\"},{\"label\":\"紧急\",\"value\":\"1\"},{\"label\":\"非常紧急\",\"value\":\"2\"}]}]"
|
|
|
|
|
|
|
|
// 当前作业id
|
|
// 当前作业id
|
|
|
private var id = 0
|
|
private var id = 0
|
|
@@ -40,7 +41,7 @@ class VMCreateJob : VMBase() {
|
|
|
_state.value = _state.value.copy(forms = forms)
|
|
_state.value = _state.value.copy(forms = forms)
|
|
|
// 流程模板
|
|
// 流程模板
|
|
|
ApiRequest.getSopList(mutableMapOf("pageNo" to 1, "pageSize" to -1)).onSuccess {
|
|
ApiRequest.getSopList(mutableMapOf("pageNo" to 1, "pageSize" to -1)).onSuccess {
|
|
|
- val data = it.data?.list ?: emptyList()
|
|
|
|
|
|
|
+ val data = (it.data?.list ?: emptyList()).filter { sop -> sop.status == 1 }
|
|
|
val options = data.map { sop -> FormOption(sop.name, sop.id.toString()) }
|
|
val options = data.map { sop -> FormOption(sop.name, sop.id.toString()) }
|
|
|
val newForms = _state.value.forms.map { form -> if (form.id == "job_sop") form.copy(options = options) else form }
|
|
val newForms = _state.value.forms.map { form -> if (form.id == "job_sop") form.copy(options = options) else form }
|
|
|
_state.value = _state.value.copy(forms = newForms)
|
|
_state.value = _state.value.copy(forms = newForms)
|