Commit 7440fc65 by 罗绍泽

集成表单设计器

parent e9a5ce45
......@@ -22,7 +22,7 @@
<!-- 增加数据源dataSource-system -->
<bean id="dataSource-system" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close">
<!-- 基本属性 url、user、password -->
<property name="url" value="jdbc:mysql://192.168.1.116:3306/lcyq_system?useUnicode=true&amp;characterEncoding=utf8&amp;autoReconnect=true&amp;useSSL=false" />
<property name="url" value="jdbc:mysql://192.168.1.249:3306/lcyq_system?useUnicode=true&amp;characterEncoding=utf8&amp;autoReconnect=true&amp;useSSL=false" />
<property name="username" value="lcyq_system" />
<property name="password" value="lcyq_system" />
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
......@@ -73,9 +73,9 @@
<!-- 增加数据源dataSource-standard -->
<bean id="dataSource-standard" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close">
<!-- 基本属性 url、user、password -->
<property name="url" value="jdbc:mysql://192.168.1.116:3306/jw_standard?useUnicode=true&amp;characterEncoding=utf8&amp;autoReconnect=true&amp;useSSL=false" />
<property name="username" value="jw_standard" />
<property name="password" value="jw_standard" />
<property name="url" value="jdbc:mysql://192.168.1.249:3306/jf_standard?useUnicode=true&amp;characterEncoding=utf8&amp;autoReconnect=true&amp;useSSL=false" />
<property name="username" value="jf_standard" />
<property name="password" value="jf_standard" />
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<!-- 配置初始化大小、最小、最大 -->
......@@ -124,7 +124,7 @@
<!-- 增加数据源dataSource-business -->
<bean id="dataSource-business" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close">
<!-- 基本属性 url、user、password -->
<property name="url" value="jdbc:mysql://192.168.1.116:3306/lcyq_business?useUnicode=true&amp;characterEncoding=utf8&amp;autoReconnect=true&amp;useSSL=false" />
<property name="url" value="jdbc:mysql://192.168.1.249:3306/lcyq_business?useUnicode=true&amp;characterEncoding=utf8&amp;autoReconnect=true&amp;useSSL=false" />
<property name="username" value="lcyq_business" />
<property name="password" value="lcyq_business" />
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
......@@ -175,7 +175,7 @@
<!-- 增加数据源dataSource-activiti -->
<bean id="dataSource-activiti" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close">
<!-- 基本属性 url、user、password -->
<property name="url" value="jdbc:mysql://192.168.1.116:3306/lcyq_activiti?useUnicode=true&amp;characterEncoding=utf8&amp;autoReconnect=true&amp;useSSL=false" />
<property name="url" value="jdbc:mysql://192.168.1.249:3306/lcyq_activiti?useUnicode=true&amp;characterEncoding=utf8&amp;autoReconnect=true&amp;useSSL=false" />
<property name="username" value="lcyq_activiti" />
<property name="password" value="lcyq_activiti" />
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
......
......@@ -63,6 +63,15 @@
<link rel="stylesheet" type="text/css" href="<%=commonPath%>/ria/jquery/jquery-easyui-1.4.1/themes/icon.css" charset="utf-8"></link>
<link rel="stylesheet" type="text/css" href="<%=commonPath%>/ria/jquery/zTree_v3/css/zTreeStyle/zTreeStyle.css" charset="utf-8"></link>
<!-- 添加vue支持 -->
<script type="text/javascript" src="<%=localPath %>/js/vue/vue.js"></script>
<!-- 添加element UI支持 -->
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<!-- 添加表单设计器支持 -->
<link rel="stylesheet" href="https://unpkg.com/form-making/dist/FormMaking.css">
<script src="https://unpkg.com/form-making/dist/FormMaking.umd.js"></script>
<script type="text/javascript">
// $.ajaxSetup ({
// cache: false //关闭AJAX相应的缓存
......
This source diff could not be displayed because it is too large. You can view the blob instead.
<%@page contentType="text/html; charset=UTF-8"%>
<form id="inputForm" method="post" style="width: 100%;">
<input type="hidden" name="FIELD_OPETYPE" id="OPETYPE" value="${is_row.OPETYPE}" /> <input type="hidden" name="FIELD_UUID" id="UUID" value="${is_row.UUID}" />
<input type="hidden" name="FIELD_OPETYPE" id="OPETYPE" value="${is_row.OPETYPE}" />
<input type="hidden" name="FIELD_UUID" id="UUID" value="${is_row.UUID}" />
<table align="center" border="0" cellpadding="0" cellspacing="0" class="tableStyle" style="margin: 10px 15px; width: 95%; line-height: 30px;">
<tr>
<td style="width: 10%;" class="tableStyleLable">
......@@ -18,7 +19,73 @@
</td> -->
</tr>
</table>
<div id="ueditId" name="FIELD_ueditValue" style="height:100%">
</div>
<fm-making-form ref="fmMakeForm" preview>
<template slot="action">
<button @click="makeJson" type="button" class="el-button el-button--text el-button--medium">
<i class="el-icon-tickets"></i>
<span>生成JSON</span>
</button>
</template>
</fm-making-form>
<textarea id="ueditId" v-model="jsonStr" name="FIELD_MODEL_CONTENT" style="height:200px;width:100%">
</textarea>
</form>
\ No newline at end of file
</form>
<script>
$(function(){
new Vue({
el:"#inputForm",
data:{
json:{"list":[],"config":{"labelWidth":100,"labelPosition":"top","size":"small"}}
},
computed:{
jsonStr:{
set:function(value){
try{
this.json=JSON.parse(value);
}catch(e){
}
},
get:function(){
return JSON.stringify(this.json);
}
}
},
methods:{
makeJson:function(){
this.json=this.$refs['fmMakeForm'].getJSON();
}
},
mounted:function(){
if('${is_row.MODEL_CONTENT}'=='{}'){
return;
}
var modelContent=${is_row.MODEL_CONTENT};
console.log(modelContent);
if(modelContent){
this.json=modelContent;
this.$refs['fmMakeForm'].setJSON(modelContent);
}
}
});
});
</script>
<style>
.el-message-box__wrapper{
z-index:10001 !important
}
.el-dialog__wrapper{
z-index:9999 !important
}
.v-modal{
z-index:9998 !important
}
.el-picker-panel{
z-index:10001 !important
}
.el-select-dropdown{
z-index:10000 !important
}
</style>
\ No newline at end of file
......@@ -141,10 +141,10 @@ function addUrlOnloadCallback(is_row){
//保存
function insertData(is_entity){
var tableId = $.getUrlParam("tableId");
var ue=UE.getEditor('ueditId');
//var ue=UE.getEditor('ueditId');
is_entity.FIELD_TABLE_ID=tableId;
is_entity.FIELD_FLAG=is_entity.FLAG;
is_entity.FIELD_MODEL_CONTENT=ue.getContent();
//is_entity.FIELD_MODEL_CONTENT=ue.getContent();
delete is_entity.FIELD_ueditValue;
var v_result = formmodelModule.act.insertFormModel(is_entity);
$('#list').datagrid('reload');
......@@ -157,17 +157,28 @@ function editRow(index) {
var is_row = $('#list').datagrid('getSelections');
$('#list').datagrid('clearSelections');
is_row[0].OPETYPE = 'update';
openEditRow("formmodelView_formmodelTabDetail",is_row[0],"编辑",true,0.95,0.95,0,0);
var row={};
$.extend(true,row,is_row[0]);
//去掉大文本内容MODEL_CONTENT
delete row.MODEL_CONTENT;
openEditRow("formmodelView_formmodelTabDetail",row,"编辑",true,0.95,0.95,0,0);
}
//加载修改子页面成功后的回调
function updateUrlOnloadCallback(is_row){
var rows=$('#list').datagrid('getRows');
for(var i=0;i<rows.length;i++){
if(rows[i].UUID==is_row.UUID){
is_row.MODEL_CONTENT=rows[i].MODEL_CONTENT;
break;
}
}
initUeditor(is_row);
}
function initUeditor(is_row){
console.log(is_row);
return
UE.delEditor('ueditId');
var ue=UE.getEditor('ueditId',{});
ue.ready(function(){
......@@ -180,8 +191,8 @@ function initUeditor(is_row){
//保存
function updateData(is_entity){
var ue=UE.getEditor('ueditId');
is_entity.FIELD_MODEL_CONTENT=ue.getContent();
//var ue=UE.getEditor('ueditId');
//is_entity.FIELD_MODEL_CONTENT=ue.getContent();
delete is_entity.FIELD_ueditValue;
v_result = formmodelModule.act.updateFormModel(is_entity);
$('#list').datagrid('reload');
......
......@@ -18,6 +18,8 @@ procinstanceModule.prototype.updateInfo = function(){};
procinstanceModule.prototype.updateInfoToNext = function(){};
//删除流程实例
procinstanceModule.prototype.deleteInfo = function(){};
//回退流程实例
procinstanceModule.prototype.back = function(){};
//创建一个数据操作对象,然后再后续使用
procinstanceModule.act = new procinstanceModule("json").delegate("procinstanceAct");
......
var procinstanceTab_vue=null;
/**
* 序号:1
* 功能:定义分页(EasyUI)
......@@ -176,6 +177,7 @@ function addRow(){
}
//加载增加子页面成功后的回调
function addUrlOnloadCallback(is_row){
procinstanceTab_vue=null;
$('#detail #FIELD_PROCDEFINITION_UUID').combobox({
data : v_data_procdefinition2,
valueField : 'UUID',
......@@ -190,19 +192,37 @@ function addUrlOnloadCallback(is_row){
}
//保存
function insertData(is_entity){
is_entity.FIELD_PROCID=$('#detail #FIELD_PROCDEFINITION_UUID').combobox("getValue");
is_entity.FIELD_FORM_MODEL_ID=$("#FIELD_FORM_MODEL_ID").val();
var v_result = procinstanceModule.act.insertInfo(is_entity);
$('#list').datagrid('reload');
return v_result;
procinstanceTab_vue.$refs.generateForm.getData().then(data => {
is_entity=data;
is_entity.FIELD_PROCID=$('#detail #FIELD_PROCDEFINITION_UUID').combobox("getValue");
is_entity.FIELD_FORM_MODEL_ID=$("#FIELD_FORM_MODEL_ID").val();
var v_result = procinstanceModule.act.insertInfo(is_entity);
$('#list').datagrid('reload');
if (v_result != null && v_result != undefined) {
closeBox('detail');
$.messager.alert('提示', v_result.VALUE);
}
}).catch(e => {
// 数据校验失败
console.log(e);
})
}
function insertDataToNext(is_entity){
is_entity.FIELD_PROCID=$('#detail #FIELD_PROCDEFINITION_UUID').combobox("getValue");
is_entity.FIELD_FORM_MODEL_ID=$("#FIELD_FORM_MODEL_ID").val();
var v_result = procinstanceModule.act.insertInfoToNext(is_entity);
$('#list').datagrid('reload');
return v_result;
procinstanceTab_vue.$refs.generateForm.getData().then(data => {
is_entity=data;
is_entity.FIELD_PROCID=$('#detail #FIELD_PROCDEFINITION_UUID').combobox("getValue");
is_entity.FIELD_FORM_MODEL_ID=$("#FIELD_FORM_MODEL_ID").val();
var v_result = procinstanceModule.act.insertInfoToNext(is_entity);
$('#list').datagrid('reload');
if (v_result != null && v_result != undefined) {
closeBox('detail');
$.messager.alert('提示', v_result.VALUE);
}
}).catch(e => {
// 数据校验失败
console.log(e);
})
}
//加载修改子页面
......@@ -216,27 +236,62 @@ function editRow(index) {
//加载修改子页面成功后的回调
function updateUrlOnloadCallback(is_row){
procinstanceTab_vue=null;
fillTable2(is_row.BUSINESS_ID,is_row.TASK_ID);
}
//保存
function updateData(is_entity){
var v_result = procinstanceModule.act.updateInfo(is_entity);
$('#list').datagrid('reload');
return v_result;
function updateData(is_entity) {
procinstanceTab_vue.$refs.generateForm.getData().then(data => {
is_entity = data;
var v_result = procinstanceModule.act.updateInfo(is_entity);
$('#list').datagrid('reload');
if (v_result != null && v_result != undefined) {
closeBox('detail');
$.messager.alert('提示', v_result.VALUE);
}
}).catch(e => {
// 数据校验失败
console.log(e);
})
}
function fillTable2(businessId,taskId){
var info=proctaskModule.data.getInfo({
FIELD_BUSINESS_ID:businessId
});
$("#table_content").html(info.FORM_MODEL.MODEL_CONTENT);
for(key in info.BUSINESS_DATA){
info.BUSINESS_DATA['FIELD_'+key]=info.BUSINESS_DATA[key];
//过滤非业务字段
if(key!='BUSINESS_ID'&&
key!='COMPLETE'&&
key!='PROC_DEFINITION_ID'&&
key!='PROC_NAME'){
info.BUSINESS_DATA['FIELD_'+key]=info.BUSINESS_DATA[key];
}
delete info.BUSINESS_DATA[key];
}
info.BUSINESS_DATA['FIELD_OPETYPE']='update';
if(typeof dataProcessing=='function'){
if (procinstanceTab_vue == null) {
procinstanceTab_vue = new Vue({
el : '#inputForm',
data : {
jsonData : {"list":[],"config":{"labelWidth":100,"labelPosition":"top","size":"small"}},
editData : {},
remoteFuncs : {}
}
});
}
try{
procinstanceTab_vue.jsonData=JSON.parse(info.FORM_MODEL.MODEL_CONTENT);
}catch(e){
procinstanceTab_vue.jsonData={"list":[],"config":{"labelWidth":100,"labelPosition":"top","size":"small"}};
}
procinstanceTab_vue.editData=info.BUSINESS_DATA;
console.log(info.BUSINESS_DATA);
/*if(typeof dataProcessing=='function'){
dataProcessing(info);
}
......@@ -245,13 +300,7 @@ function fillTable2(businessId,taskId){
if(typeof afterLoadSuccess=='function'){
afterLoadSuccess(info);
}
$.parser.parse('#table_content');
}
//下一步按钮执行事件
function updateDataToNext(is_entity){
var v_result = procinstanceModule.act.updateInfoToNext(is_entity);
$('#list').datagrid('reload');
return v_result;
$.parser.parse('#table_content');*/
}
/****/
......@@ -524,15 +573,29 @@ function fillTable(){
FIELD_PROCDEFINITION_UUID:$('#detail #FIELD_PROCDEFINITION_UUID').combobox("getValue")
});
var table_content=table_model.MODEL;
$("#table_content").html('');
$("#FIELD_FORM_MODEL_ID").val('');
if($('#detail #FIELD_PROCDEFINITION_UUID').combobox("getValue")==''){
//什么都不做
}else if(table_content.MODEL_CONTENT=='-1'){
$.messager.alert('提示','该流程对应的表没有设置有效的模板信息!');
}else{
$("#table_content").html(table_content.MODEL_CONTENT);
}else {
if (procinstanceTab_vue == null) {
procinstanceTab_vue = new Vue({
el : '#inputForm',
data : {
jsonData : {"list":[],"config":{"labelWidth":100,"labelPosition":"top","size":"small"}},
editData : {},
remoteFuncs : {},
length:10
}
});
}
try{
procinstanceTab_vue.jsonData=JSON.parse(table_content.MODEL_CONTENT);
}catch(e){
procinstanceTab_vue.jsonData={"list":[],"config":{"labelWidth":100,"labelPosition":"top","size":"small"}};
}
$("#FIELD_FORM_MODEL_ID").val(table_content.UUID);
}
if(typeof afterLoadSuccess=='function'){
......@@ -555,8 +618,32 @@ function showProcinstanceImg(index) {
}
//流程退回
function backProc(is_entity){
var v_result = proctaskModule.act.back(is_entity);
$('#list').datagrid('reload');
return v_result;
function backProc(is_entity) {
procinstanceTab_vue.$refs.generateForm.getData().then(data => {
is_entity = data;
var v_result = procinstanceModule.act.back(is_entity);
$('#list').datagrid('reload');
if (v_result != null && v_result != undefined) {
closeBox('detail');
$.messager.alert('提示', v_result.VALUE);
}
}).catch(e => {
// 数据校验失败
console.log(e);
})
}
//下一步按钮执行事件
function updateDataToNext(is_entity){
procinstanceTab_vue.$refs.generateForm.getData().then(data => {
is_entity=data;
var v_result = procinstanceModule.act.updateInfoToNext(is_entity);
$('#list').datagrid('reload');
if (v_result != null && v_result != undefined) {
closeBox('detail');
$.messager.alert('提示', v_result.VALUE);
}
}).catch(e => {
// 数据校验失败
console.log(e);
})
}
\ No newline at end of file
......@@ -6,5 +6,13 @@
<form id="inputForm" method="post" style="width: 100%;">
<input type="hidden" name="FIELD_OPETYPE" id="OPETYPE" value="${is_row.OPETYPE}" />
<input type="hidden" name="FIELD_UUID" id="UUID" value="${is_row.UUID}" />
<div id="table_content"></div>
</form>
\ No newline at end of file
<fm-generate-form :data="jsonData" :remote="remoteFuncs"
:value="editData"
ref="generateForm"></fm-generate-form>
</form>
<style>
.el-picker-panel {
z-index: 10001 !important
}
</style>
\ No newline at end of file
......@@ -2,5 +2,13 @@
<form id="inputForm" method="post" style="width: 100%;">
<input type="hidden" name="FIELD_OPETYPE" id="OPETYPE" value="${is_row.OPETYPE}" />
<input type="hidden" name="FIELD_UUID" id="UUID" value="${is_row.UUID}" />
<div id="table_content"></div>
</form>
\ No newline at end of file
<fm-generate-form :data="jsonData" :remote="remoteFuncs"
:value="editData"
ref="generateForm"></fm-generate-form>
</form>
<style>
.el-picker-panel {
z-index: 10001 !important
}
</style>
\ No newline at end of file
......@@ -43,6 +43,14 @@ public interface ProcinstanceBusiness {
* @throws BusinessException
*/
Map<String, Object> update_proc_instance_next(Map<String, Object> entity) throws ActivitiException,BusinessException;
/**
* 回退
*
* @param entity
* @throws BusinessException
*/
Map<String, Object> back(Map<String, Object> entity) throws ActivitiException,BusinessException;
/**
* 删除记录
......
......@@ -197,7 +197,10 @@ public class ProcdefinitionBusinessImpl implements ProcdefinitionBusiness {
}
Map<String, Object> query=new HashMap<String, Object>();
query.put("UUID", procdefinitionUuid);
String tableId=procdefinitionDAO.list_procde_finition(query).get(0).get("TABLE_ID").toString();
Map<String, Object> procDefinition=procdefinitionDAO.list_procde_finition(query).get(0);
String tableId=procDefinition.get("TABLE_ID").toString();
String tableChinaeseName = procDefinition.get("CONTENT").toString();
Map<String, Object> query2=new HashMap<String, Object>();
query2.put("FLAG", 1);
query2.put("TABLE_ID", tableId);
......@@ -208,7 +211,9 @@ public class ProcdefinitionBusinessImpl implements ProcdefinitionBusiness {
}};
}
return listFormmodels.get(0);
Map<String, Object> result=listFormmodels.get(0);
result.put("TABLE_CHINAESE_NAME", tableChinaeseName);
return result;
}
/**
......
......@@ -181,6 +181,18 @@ public class ProcinstanceBusinessImpl implements ProcinstanceBusiness {
}
return entity;
}
@Override
public Map<String, Object> back(Map<String, Object> entity) throws ActivitiException,BusinessException {
ActivitiResultEnum activitiResultEnum = ActivitiTools.save(entity, ActivitiOptEnum.RALLBACK);
switch (activitiResultEnum) {
case OK:
break;
default:
throw new ActivitiException(activitiResultEnum.getMsg());
}
return entity;
}
@Override
public void delete_proc_instance(List<String> list) throws BusinessException {
......
......@@ -201,13 +201,16 @@ public class ProctaskBusinessImpl implements ProctaskBusiness {
// 根据表单模板id获取模板
Map<String, Object> formModel = getFormModelById(formModelId);
// 根据流程定义id获取存储业务数据的表
String tableName = getBusinessTableNameByProcDefinitionId(procDefinitionId);
Map<String, Object> procDefinition=getProcDefinitionByProcDefinitionId(procDefinitionId);
String tableName = procDefinition.get("TABLE_NAME").toString();
String tableChinaeseName = procDefinition.get("CONTENT").toString();
// 根据业务数据的表名和业务id,查询业务数据
Map<String, Object> businessData = getBusinessDataByBusinessTableAndBusinessId(tableName, businessId);
// 填充返回数据
info.put("FORM_MODEL", formModel);
info.put("BUSINESS_DATA", businessData);
info.put("PROCINSTANCE", procinstance);
info.put("TABLE_CHINAESE_NAME", tableChinaeseName);
}
return info;
}
......@@ -225,9 +228,29 @@ public class ProctaskBusinessImpl implements ProctaskBusiness {
* @return
*/
private String getBusinessTableNameByProcDefinitionId(String procDefinitionId) {
return getProcDefinitionByProcDefinitionId(procDefinitionId).get("TABLE_NAME").toString();
}
/**
* 根据流程定义id获取业务数据表的中文表名
*
* @param procDefinitionId
* @return
*/
private String getBusinessTableContentByProcDefinitionId(String procDefinitionId) {
return getProcDefinitionByProcDefinitionId(procDefinitionId).get("CONTENT").toString();
}
/**
* 根据流程定义id获取流程定义对象
*
* @param procDefinitionId
* @return
*/
private Map<String, Object> getProcDefinitionByProcDefinitionId(String procDefinitionId) {
Map<String, Object> query = new HashMap<String, Object>();
query.put("UUID", procDefinitionId);
return procdefinitionDAO.list_procde_finition(query).get(0).get("TABLE_NAME").toString();
return procdefinitionDAO.list_procde_finition(query).get(0);
}
private Map<String, Object> getBusinessDataByBusinessTableAndBusinessId(String tableName, String uuid) {
......
package com.gaowj.formmodel.action;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.gaowj.business.FormmodelsBusiness;
import com.gaowj.business.action.BasicAction;
import com.gaowj.business.comp.BusinessManager;
import com.gaowj.business.exception.BusinessException;
import com.gaowj.business.util.Page;
import com.gaowj.business.util.RequestUtils;
public class viewAction extends BasicAction{
......@@ -12,9 +17,24 @@ public class viewAction extends BasicAction{
return "formmodelTab";
}
public String formmodelTabDetail() throws BusinessException{
Map<String,Object> query = RequestUtils.getUpdateFieldMapUtf8(request, RequestUtils.UPDATEDATAFIELDPREFIX);
request.setAttribute("is_row", query);
public String formmodelTabDetail() throws BusinessException {
FormmodelsBusiness business = BusinessManager.getBusiness(FormmodelsBusiness.class);
Map<String, Object> query2 = RequestUtils.getUpdateFieldMapUtf8(request, RequestUtils.UPDATEDATAFIELDPREFIX);
query2.put("MODEL_CONTENT", "{}");
Map<String, Object> query = new HashMap<String, Object>();
if (query2.get("UUID") != null) {
query.put("UUID", query2.get("UUID"));
Page<Map<String, Object>> pageRows = business.list_form_model(1, 1, query);
List<Map<String, Object>> list = pageRows.getItems();
if (list.size() > 0) {
query = list.get(0);
query2.put("MODEL_CONTENT", list.get(0).get("MODEL_CONTENT"));
}
}
request.setAttribute("is_row", query2);
return "formmodelTabDetail";
}
......
package com.gaowj.process.action;
import java.sql.SQLException;
import java.util.Map;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.gaowj.business.ProcdefinitionBusiness;
import com.gaowj.business.ProctaskBusiness;
import com.gaowj.business.action.BasicAction;
import com.gaowj.business.comp.BusinessManager;
import com.gaowj.business.exception.BusinessException;
import com.gaowj.business.util.QueryParamUtil;
import com.gaowj.business.util.RequestUtils;
public class viewAction extends BasicAction {
......@@ -22,12 +25,18 @@ public class viewAction extends BasicAction {
// 通过流程id,获取表单
ProcdefinitionBusiness business = BusinessManager.getBusiness(ProcdefinitionBusiness.class);
Map<String, Object> model = business.findFormModel(procId);
//获取表的中文名
request.setAttribute("tableChinaeseName", model.get("TABLE_CHINAESE_NAME"));
model.remove("TABLE_CHINAESE_NAME");
request.setAttribute("modelContent", model.get("MODEL_CONTENT"));
request.setAttribute("modelId", model.get("UUID"));
} else {
// 如果有业务id,则显示空表单和表单数据
ProctaskBusiness business = BusinessManager.getBusiness(ProctaskBusiness.class);
Map<String, Object> info = business.data_info(businessId);
request.setAttribute("tableChinaeseName", info.get("TABLE_CHINAESE_NAME"));
Map<String, Object> formModel = (Map<String, Object>) info.get("FORM_MODEL");
request.setAttribute("modelContent", formModel.get("MODEL_CONTENT"));
request.setAttribute("modelId", formModel.get("UUID"));
......@@ -37,7 +46,12 @@ public class viewAction extends BasicAction {
request.setAttribute("instanceId", procinstance.get("INSTANCE_ID"));
// 获取表单数据
Map<String, Object> businessData = (Map<String, Object>) info.get("BUSINESS_DATA");
request.setAttribute("businessData", JSONObject.toJSON(businessData));
try {
request.setAttribute("businessData", JSON.parse(JSON.toJSONString(QueryParamUtil.DateTimeToString(businessData))));
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// 将业务主键id传回去
request.setAttribute("businessId", businessId);
}
......
......@@ -183,5 +183,39 @@ public class actAction extends BasicAction {
}
return "json";
}
/**
* 更新
*
* @param entity
* @throws BusinessException
*/
public String back() throws BusinessException {
ProcinstanceBusiness business = BusinessManager.getBusiness(ProcinstanceBusiness.class);
Map<String, Object> entity = RequestUtils.getUpdateFieldMap(request, RequestUtils.UPDATEDATAFIELDPREFIX);
jsonObject = new JSONObject();
try {
entity = QueryParamUtil.StringToDate(entity);
// 去除不要更新的字段
entity.remove("OPETYPE");
// 更新
Map<String, Object> procinstance = business.update_proc_instance_next(entity);
// 操作日志
// sysbusiness.insert_logBusiness(具体方法,操作内容,操作描述,操作记录ID,操作记录中文描述,分类)
SystemOpeBusiness sysbusiness = BusinessManager.getBusiness(SystemOpeBusiness.class);
sysbusiness.insert_logBusiness("back", "" + procinstance, "回退流程实例数据", (String) entity.get("UUID"), (String) entity.get("CONTENT"), "procinstance");
//
//
jsonObject.putAll(Status.getStatusSuccessMessage("保存成功"));
} catch (ActivitiException e) {
jsonObject.putAll(Status.getStatusErrorMessage(e.getMessage()));
e.printStackTrace();
} catch (Exception e) {
jsonObject.putAll(Status.getStatusErrorMessage(e.getMessage()));
e.printStackTrace();
}
return "json";
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment