新增解析表单
This commit is contained in:
parent
e02ab9e343
commit
e6e406f428
|
@ -224,8 +224,9 @@ public class FormController{
|
|||
* @param id 表单记录id
|
||||
* @return 是否发起成功
|
||||
*/
|
||||
@PostMapping("/form/startProcess")
|
||||
@GetMapping("/form/startProcess")
|
||||
@ResponseBody
|
||||
@Transactional
|
||||
public AjaxResult startProcess(Integer id){
|
||||
SysFormDataRecord sysFormDataRecord = sysFormDataRecordService.selectSysFormDataRecordById(id);
|
||||
SysFormInstance sysFormInstance = sysFormInstanceService.selectSysFormInstanceById(Long.parseLong(sysFormDataRecord.getFormId()));
|
||||
|
@ -235,13 +236,13 @@ public class FormController{
|
|||
startProcessDTO.setProcessDefinitionKey(sysFormInstance.getProcessKey());
|
||||
String formData=sysFormDataRecord.getFormData();
|
||||
String formField = sysFormDataRecord.getFormField();
|
||||
Map<String, Object> variables = Convert.toMap(String.class, Object.class, JSON.parseArray(formField));
|
||||
Map<String, Object> variables = Convert.toMap(String.class, Object.class, JSON.parse(formField));
|
||||
variables.put(FlowConstants.FORM_DATA,formData);
|
||||
variables.put(FlowConstants.PROCESS_TYPE,FlowTypeEnum.FORM_PROCESS.getCode());
|
||||
startProcessDTO.setVariables(variables);
|
||||
ProcessInstance processInstance = flowableService.startProcessInstanceByKey(startProcessDTO);
|
||||
log.info("@@表单编号:{},发起流程:{}",sysFormDataRecord.getFormNo(),JSON.toJSONString(processInstance));
|
||||
return AjaxResult.success(sysFormDataRecord.getFormData());
|
||||
return AjaxResult.success();
|
||||
}
|
||||
/**
|
||||
* 构建子表数据
|
||||
|
|
|
@ -207,7 +207,9 @@ public class SysFormInstanceController extends BaseController
|
|||
SysUser sysUser = sysUserService.selectUserById(Long.parseLong(t.getBelongUserId()));
|
||||
formDataRecordResponse.setFormName(sysFormInstance.getFormName());
|
||||
formDataRecordResponse.setBelongUserName(sysUser.getUserName());
|
||||
formDataRecordResponse.setProcessFlag(StrUtil.isNotBlank(sysFormInstance.getProcessKey()));
|
||||
formDataRecordResponseList.add(formDataRecordResponse);
|
||||
|
||||
});
|
||||
return formDataRecordResponseList;
|
||||
}
|
||||
|
|
|
@ -54,4 +54,5 @@ public class SysFormDataRecord extends BaseEntity
|
|||
|
||||
/** 版本号 */
|
||||
private Integer version;
|
||||
|
||||
}
|
||||
|
|
|
@ -47,4 +47,9 @@ public class FormDataRecordResponse extends BaseEntity implements Serializable {
|
|||
|
||||
/** 版本号 */
|
||||
private Integer version;
|
||||
|
||||
/**
|
||||
* 流程标识
|
||||
*/
|
||||
private Boolean processFlag=false;
|
||||
}
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
package com.snow.from.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.snow.common.core.text.Convert;
|
||||
import com.snow.common.utils.DateUtils;
|
||||
import com.snow.from.domain.SysFormDataRecord;
|
||||
import com.snow.from.domain.SysFormInstance;
|
||||
import com.snow.from.mapper.SysFormDataRecordMapper;
|
||||
import com.snow.from.service.ISysFormDataRecordService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -22,6 +25,9 @@ public class SysFormDataRecordServiceImpl implements ISysFormDataRecordService
|
|||
@Autowired
|
||||
private SysFormDataRecordMapper sysFormDataRecordMapper;
|
||||
|
||||
@Autowired
|
||||
private SysFormInstanceServiceImpl sysFormInstanceService;
|
||||
|
||||
/**
|
||||
* 查询单数据记录
|
||||
*
|
||||
|
@ -48,7 +54,8 @@ public class SysFormDataRecordServiceImpl implements ISysFormDataRecordService
|
|||
@Override
|
||||
public List<SysFormDataRecord> selectSysFormDataRecordList(SysFormDataRecord sysFormDataRecord)
|
||||
{
|
||||
return sysFormDataRecordMapper.selectSysFormDataRecordList(sysFormDataRecord);
|
||||
List<SysFormDataRecord> sysFormDataRecordList=sysFormDataRecordMapper.selectSysFormDataRecordList(sysFormDataRecord);
|
||||
return sysFormDataRecordList;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -68,6 +68,10 @@
|
|||
align: 'center',
|
||||
formatter: function(value, row, index) {
|
||||
var actions = [];
|
||||
console.log("======="+JSON.stringify(row));
|
||||
if(row.processFlag){
|
||||
actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="startProcess(\'' + row.id+ '\')"><i class="fa fa-eyes"></i>发起流程</a> ');
|
||||
}
|
||||
actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="formRecordDetail(\'' + row.id+ '\')"><i class="fa fa-eyes"></i>详情</a> ');
|
||||
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
|
||||
return actions.join('');
|
||||
|
@ -89,6 +93,13 @@
|
|||
var detailUrl="/toFormRecordDetail?id="+id;
|
||||
$.modal.openTab("表单详情", detailUrl);
|
||||
}
|
||||
|
||||
function startProcess(id) {
|
||||
var url="/form/startProcess?id="+id;
|
||||
$.modal.confirm("确定发起该条" + table.options.modalName + "流程吗?", function() {
|
||||
$.operate.get(url);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue