表单加流程

此处以规划设计模块的修改报批稿为例

目录

此处以规划设计模块的修改报批稿为例

一、后端

1.1、DaoImpl

 1.2、Form

1.3、model 

1.3.1、GhPlanningXgbp

1.3.2、GhPlanningXgbp.hbm.xml 

1.4、ServiceImpl 

1.5、ApplicationResources.properties 

二、前端

2.1、edit.jsp

2.2、view.jsp 

2.3、tree.jsp 

三、配置

3.1、Json

 3.2、design.xml


一、后端

1.1、DaoImpl

public String add(IBaseModel modelObj) throws Exception {
    GhPlanningXgbp ghPlanningXgbp = (GhPlanningXgbp) modelObj;
    if (ghPlanningXgbp.getDocCreator() == null) {
        ghPlanningXgbp.setDocCreator(UserUtil.getUser());
    }
    if (ghPlanningXgbp.getDocCreateTime() == null) {
        ghPlanningXgbp.setDocCreateTime(new Date());
    }
    if (ghPlanningXgbp.getDocSubject() == null && ghPlanningXgbp.getFdProduceGcjd() != null) {
        ghPlanningXgbp.setDocSubject(ghPlanningXgbp.getFdProduceGcjd().getFdProduceGcxx().getFdName() + "-" +
                ghPlanningXgbp.getFdProduceGcjd().getFdCateGcjd().getFdName() + "-" +
                ResourceUtil.getString("table.ghPlanningXgbp", "gh-planning"));
    }
    return super.add(ghPlanningXgbp);
}
@Override
public void update(IBaseModel modelObj) throws Exception {
    GhPlanningXgbp ghPlanningXgbp = (GhPlanningXgbp) modelObj;
    if (ghPlanningXgbp.getDocSubject() == null && ghPlanningXgbp.getFdProduceGcjd() != null) {
        ghPlanningXgbp.setDocSubject(ghPlanningXgbp.getFdProduceGcjd().getFdProduceGcxx().getFdName() + "-" +
                ghPlanningXgbp.getFdProduceGcjd().getFdCateGcjd().getFdName() + "-" +
                ResourceUtil.getString("table.ghPlanningXgbp", "gh-planning"));
    }
    super.update(modelObj);
}

需要在新增和修改的时候给 docSubject 这个字段赋值,发送待办的时候需要用到这个字段

 1.2、Form

private String docSubject;

private LbpmProcessForm sysWfBusinessForm = new LbpmProcessForm();

docSubject = null;
sysWfBusinessForm = new LbpmProcessForm();

public LbpmProcessForm getSysWfBusinessForm() {
        return sysWfBusinessForm;
}

toModelPropertyMap.addNoConvertProperty("docStatus");

/**
 * 标题
 */
public String getDocSubject() {
    return this.docSubject;
}
/**
 * 标题
 */
public void setDocSubject(String docSubject) {
    this.docSubject = docSubject;
}

Form 层需要看有没有 docStatus、docsubject 和 sysWfBusinessForm 这些字段

此接口必须实现 ISysLbpmMainForm 这个接口

1.3、model 

1.3.1、GhPlanningXgbp

private String docSubject;

private LbpmProcessForm sysWfBusinessModel = new LbpmProcessForm();

public LbpmProcessForm getSysWfBusinessModel() {
        return sysWfBusinessModel;
}

/**
 * 标题
 */
public String getDocSubject() {
    return this.docSubject;
}
/**
 * 标题
 */
public void setDocSubject(String docSubject) {
    this.docSubject = docSubject;
}

model 层也需要加上  docStatus、docsubject 和 sysWfBusinessForm 这些字段

此接口必须实现 ISysLbpmMainModel 接口

1.3.2、GhPlanningXgbp.hbm.xml 

<property
        name="docStatus"
        column="doc_status"
        update="true"
        insert="true"
        length="2"/>
<property
        name="docSubject"
        column="doc_subject"
        update="true"
        insert="true"
        length="200"/>

需要加上 docStatus 和 docSubject 这俩个字段 

1.4、ServiceImpl 

private ISysNotifyMainCoreService sysNotifyMainCoreService;

private ILbpmProcessCoreService lbpmProcessCoreService;

public IBaseModel convertBizFormToModel(IExtendForm form, IBaseModel model, ConvertorContext context) throws Exception {
    model = super.convertBizFormToModel(form, model, context);
    if (model instanceof GhPlanningXgbp) {
        GhPlanningXgbp ghPlanningXgbp = (GhPlanningXgbp) model;
        GhPlanningXgbpForm ghPlanningXgbpForm = (GhPlanningXgbpForm) form;
        if (ghPlanningXgbp.getDocStatus() == null || ghPlanningXgbp.getDocStatus().startsWith("1")) {
            if (ghPlanningXgbpForm.getDocStatus() != null && (ghPlanningXgbpForm.getDocStatus().startsWith("1") || ghPlanningXgbpForm.getDocStatus().startsWith("2"))) {
                ghPlanningXgbp.setDocStatus(ghPlanningXgbpForm.getDocStatus());
            }
        }
    }
    return model;
}

public IBaseModel initBizModelSetting(RequestContext requestContext) throws Exception {
    GhPlanningXgbp ghPlanningXgbp = new GhPlanningXgbp();
    ghPlanningXgbp.setDocCreateTime(new Date());
    ghPlanningXgbp.setDocCreator(UserUtil.getUser());
    ghPlanningXgbp.setDocDept(UserUtil.getUser().getFdParent());
    //设置机构
    ghPlanningXgbp.setFdOrg(UserUtil.getUser().getFdParentOrg());
    GhPlanningUtil.initModelFromRequest(ghPlanningXgbp, requestContext);
    return ghPlanningXgbp;
}

public void initCoreServiceFormSetting(IExtendForm form, IBaseModel model, RequestContext requestContext) throws Exception {
    GhPlanningXgbp ghPlanningXgbp = (GhPlanningXgbp) model;
    getLbpmProcessCoreService().initFormDefaultSetting(form, "ghPlanningXgbp", "ghPlanningXgbp", requestContext);
}

public ISysNotifyMainCoreService getSysNotifyMainCoreService() {
    if (sysNotifyMainCoreService == null) {
        sysNotifyMainCoreService = (ISysNotifyMainCoreService) SpringBeanUtil.getBean("sysNotifyMainCoreService");
    }
    return sysNotifyMainCoreService;
}

public ILbpmProcessCoreService getLbpmProcessCoreService() {
    if (lbpmProcessCoreService == null) {
        lbpmProcessCoreService = (ILbpmProcessCoreService) SpringBeanUtil.getBean("lbpmProcessCoreService");
    }
    return lbpmProcessCoreService;
}

需要加上如上所示的这些方法,具体的实体类的名称和字段不一样需要自己修改 

1.5、ApplicationResources.properties 

py.GhPlanningXgbp=修改/报批稿_通用流程模板

ghPlanningXgbp.docStatus=文档状态
ghPlanningXgbp.docSubject=标题

 py.GhPlanningXgbp=修改/报批稿_通用流程模板 是为了在接下来的 tree.jsp 文件中使用

二、前端

2.1、edit.jsp

<c:choose>
    <c:when test="${ ghPlanningXgbpForm.method_GET == 'edit' }">
        <c:if test="${ ghPlanningXgbpForm.docStatus=='10' || ghPlanningXgbpForm.docStatus=='11' }">
            <ui:button text="${ lfn:message('button.savedraft') }" onclick="if(validateDetail()){submitForm('${ghPlanningXgbpForm.docStatus}','update',true);}" />
        </c:if>
        <c:if test="${ ghPlanningXgbpForm.docStatus=='10' || ghPlanningXgbpForm.docStatus=='11' || ghPlanningXgbpForm.docStatus=='20' }">
            <ui:button text="${ lfn:message('button.submit') }" onclick="if(validateDetail()){submitForm('20','update');}" />
        </c:if>
    </c:when>
    <c:when test="${ ghPlanningXgbpForm.method_GET == 'add' }">
        <ui:button text="${ lfn:message('button.savedraft') }" order="2" onclick="if(validateDetail()){submitForm('10','save',true);}" />
        <ui:button text="${ lfn:message('button.submit') }" order="2" onclick="if(validateDetail()){submitForm('20','save');}" />
    </c:when>
</c:choose>

<c:import url="/sys/lbpmservice/import/sysLbpmProcess_edit.jsp" charEncoding="UTF-8">
    <c:param name="formName" value="ghPlanningXgbpForm"/>
    <c:param name="fdKey" value="ghPlanningXgbp"/>
    <c:param name="isExpand" value="true"/>
</c:import>

<html:hidden property="docStatus" />

因为加了 docStatus 字段,所以按钮什么时候展示的代码需要修改

导入流程的 jsp 文件,具体的 value  需要自己修改

插入一个状态的隐藏属性

2.2、view.jsp 

<c:if test="${ ghPlanningXgbpForm.docStatus=='10' || ghPlanningXgbpForm.docStatus=='11' || ghPlanningXgbpForm.docStatus=='20' }">
    <!--edit-->
    <kmss:auth requestURL="/gh/planning/gh_planning_xgbp/ghPlanningXgbp.do?method=edit&fdId=${param.fdId}">
        <ui:button text="${lfn:message('button.edit')}" onclick="Com_OpenWindow('ghPlanningXgbp.do?method=edit&fdId=${param.fdId}','_self');" order="2" />
    </kmss:auth>
</c:if>
<!--delete-->
<kmss:auth requestURL="/gh/planning/gh_planning_xgbp/ghPlanningXgbp.do?method=delete&fdId=${param.fdId}">
    <ui:button text="${lfn:message('button.delete')}" onclick="deleteDoc('ghPlanningXgbp.do?method=delete&fdId=${param.fdId}');" order="4" />
</kmss:auth>
<ui:button text="${lfn:message('button.close')}" order="5" onclick="Com_CloseWindow();" />

<c:import url="/sys/lbpmservice/import/sysLbpmProcess_view.jsp" charEncoding="UTF-8">
    <c:param name="formName" value="ghPlanningXgbpForm"/>
    <c:param name="fdKey" value="ghPlanningXgbp"/>
    <c:param name="isExpand" value="true"/>
</c:import>

此处引入的是流程的 view 界面,其它的原理同edit界面一样 

2.3、tree.jsp 

/*修改/报批稿_通用流程模板*/
<kmss:auth requestURL="/sys/lbpmservice/support/lbpm_template/index.jsp?fdModelName=com.landray.kmss.gh.planning.model.GhPlanningXgbp&fdKey=ghPlanningXgbp" requestMethod="GET">
    var node_2_25_node_1_0_node = node_1_0_node.AppendURLChild(
    '${ lfn:message("gh-planning:py.GhPlanningXgbp") }',
    '<c:url value="/sys/lbpmservice/support/lbpm_template/index.jsp?fdModelName=com.landray.kmss.gh.planning.model.GhPlanningXgbp&fdKey=ghPlanningXgbp"/>');
</kmss:auth>

对应的实体类需要自己手动修改 

三、配置

3.1、Json

"docStatus" : {
    "propertyType" : "simple",
    "messageKey" : "gh-planning:ghPlanningXgbp.docStatus",
    "type" : "String",
    "column" : "doc_status",
    "notNull" : "true",
    "readOnly" : "true",
    "enumType" : "gh_planning_doc_status",
    "validate" : "false",
    "canDisplay" : "true",
    "canRelation" : "true",
    "canSearch" : "true",
    "length" : "2"
},
"docSubject" : {
    "propertyType" : "simple",
    "messageKey" : "gh-planning:ghPlanningXgbp.docSubject",
    "type" : "String",
    "column" : "doc_subject",
    "notNull" : "true",
    "readOnly" : "false",
    "validate" : "true",
    "canDisplay" : "true",
    "canRelation" : "true",
    "canSearch" : "true",
    "length" : "200"
},

 3.2、design.xml

<request 
    path="gh_planning_xgbp/ghPlanningXgbp.do*" 
    validatorParameter="recid=fdId,model=com.landray.kmss.gh.planning.model.GhPlanningXgbp" 
    defaultValidator="roleValidator(role=ROLE_GHPLANNING_DEFAULT)">
    <query 
        queryString="method=view" 
        validator="authFieldValidator(type=SYS_READER)"/>
    <query 
        queryString="method=edit|update" 
        validator="authFieldValidator(type=SYS_EDITOR)|lbpmCurHandlerValidator(method=update)"/>
    <query 
        queryString="method=delete|deleteall" 
        validator="roleValidator(role=ROLE_GHPLANNING_SETTING)"/>
</request>

<filters 
    modelName="com.landray.kmss.gh.planning.model.GhPlanningXgbp">
    <filter 
        type="SYS_READER" 
        expression="roleFilter(role=ROLE_GHPLANNING_VIEW_ALL)"/>
    <filter 
        type="SYS_READER" 
        expression="authFieldFilter(field=authAllReaders.fdId)"/>
    <filter 
        type="SYS_READER" 
        expression="flagFieldFilter(field=authReaderFlag,value=1)"/>
    <filter 
        type="SYS_EDITOR" 
        expression="authFieldFilter(field=authAllEditors.fdId)"/>
</filters>

<flowDef
        modelName="com.landray.kmss.gh.planning.model.GhPlanningXgbp"
        key="ghPlanningXgbp"
        type="oa"
        moduleMessageKey="gh-planning:table.ghPlanningXgbp.module"
        templateModelName="com.landray.kmss.gh.planning.model.GhPlanningXgbp"/>

需要在 request 标签加上 |lbpmCurHandlerValidator(method=update) 

  • 8
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值