1

我已经根据我需要的表单字段修改了当前的生命周期工作流程,但该工作流程仅适用于一步批准。因此,如果我启动工作流程并将其分配给某人,他/她只会批准/拒绝它,这会回到我身上。

我需要的是,如果第一个批准者批准了工作流程,它应该转到第二个批准者,如果批准/拒绝应该返回给发起者(在这种情况下是我)

我的活动定义文件是

<?xml version="1.0" encoding="UTF-8" ?>

<definitions id="reimbur-definitions"
             typeLanguage="http://www.w3.org/2001/XMLSchema"
             expressionLanguage="http://www.w3.org/1999/XPath"
             targetNamespace="http://activiti.org/bpmn20" 
             xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xmlns:activiti="http://activiti.org/bpmn">

    <process id="activitireimburApproval" name="Reimbursement Application Process">
        <extensionElements>
             <!-- When process is deleted/cancelled, status should be set to draft -->
             <activiti:executionListener event="end" class="org.alfresco.repo.workflow.activiti.listener.ScriptExecutionListener">
                <activiti:field name="script">
                     <activiti:string>
                        if(cancelled || deleted) {
                            for (var i = 0; i &lt; bpm_package.children.length; i++)
                            {
                               if (!bpm_package.children[i].hasAspect("rei:status"))
                               {
                                    bpm_package.children[i].properties["rei:status"] = "Draft";
                                    bpm_package.children[i].save();
                               }
                            }
                        }
                     </activiti:string>
                  </activiti:field>
            </activiti:executionListener>
         </extensionElements>
        <startEvent id="start"
            activiti:formKey="rei:reimbursubmitReviewTask" name="Submit Application" />

        <sequenceFlow id='flow1' 
            sourceRef='start'
            targetRef='reviewTask'>
             <extensionElements>
                 <activiti:executionListener event="take" class="org.alfresco.repo.workflow.activiti.listener.ScriptExecutionListener">
                    <activiti:field name="script">
                         <activiti:string>
                            for (var i = 0; i &lt; bpm_package.children.length; i++)
                            {
                               if (!bpm_package.children[i].hasAspect("rei:status"))
                               {
                                  bpm_package.children[i].addAspect("rei:status");
                               }
                            }
                         </activiti:string>
                      </activiti:field>
                </activiti:executionListener>
             </extensionElements>
        </sequenceFlow>

        <userTask id="reviewTask" name="Review Reimbursement Application"
            activiti:formKey="rei:reimburactivitiReviewTask">
           <extensionElements>
               <activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
                  <activiti:field name="script">
                     <activiti:string>

                         for (var i = 0; i &lt; bpm_package.children.length; i++)
                         {
                            if (bpm_package.children[0].hasAspect("rei:status")) {
                                bpm_package.children[i].properties["rei:status"] = "In Review";
                                bpm_package.children[i].save();
                            }
                         }
                     </activiti:string>
                  </activiti:field>
               </activiti:taskListener>
               <activiti:taskListener event="assignment" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
                  <activiti:field name="script">
                     <activiti:string>
                        execution.setVariable('wf_reviewOutcome', task.getVariable('wf_reviewOutcome'));
                     </activiti:string>
                  </activiti:field>
               </activiti:taskListener>
           </extensionElements>
           <humanPerformer>
                <resourceAssignmentExpression>
                    <formalExpression>${bpm_assignee.properties.userName}</formalExpression>
                </resourceAssignmentExpression>
            </humanPerformer>
        </userTask>

        <sequenceFlow id='flow2' 
        sourceRef='reviewTask'
            targetRef='reviewDecision' />

         <userTask id="reviewTask2" name="Review Reimbursement Application"
            activiti:formKey="rei:reimburactivitiReviewTask">
           <extensionElements>
               <activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
                  <activiti:field name="script">
                     <activiti:string>

                         for (var i = 0; i &lt; bpm_package.children.length; i++)
                         {
                            if (bpm_package.children[0].hasAspect("rei:status")) {
                                bpm_package.children[i].properties["rei:status"] = "In Review";
                                bpm_package.children[i].save();
                            }
                         }
                     </activiti:string>
                  </activiti:field>
               </activiti:taskListener>
               <activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
                  <activiti:field name="script">
                     <activiti:string>
                        execution.setVariable('wf_reviewOutcome', task.getVariable('wf_reviewOutcome'));
                     </activiti:string>
                  </activiti:field>
               </activiti:taskListener>
           </extensionElements>
           <humanPerformer>
                <resourceAssignmentExpression>
                    <formalExpression>${bpm_assignee.properties.userName}</formalExpression>
                </resourceAssignmentExpression>
            </humanPerformer> 
        </userTask>   

        <sequenceFlow id='flow3' 
        sourceRef='reviewTask2'
            targetRef='reviewDecision' />
        <exclusiveGateway  id="reviewDecision" name="Review Reimbursement Application" /> 

        <sequenceFlow id='flow4' sourceRef='reviewDecision' targetRef='approved' >
            <conditionExpression xsi:type="tFormalExpression">${wf_reviewOutcome == 'Approve'}</conditionExpression>
        </sequenceFlow>

        <sequenceFlow id='flow5' 
        sourceRef='reviewDecision'
            targetRef='rejected' />

       <userTask id="approved" name="Reimbursement Approved"
            activiti:formKey="wf:approvedTask" >
            <documentation>
                The document was reviewed and approved.
            </documentation>
            <extensionElements>
               <activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
                  <activiti:field name="script">
                     <activiti:string>

                        for (var i = 0; i &lt; bpm_package.children.length; i++)
                        {
                           if (bpm_package.children[0].hasAspect("rei:status")) {
                               bpm_package.children[i].properties["rei:status"] = "Approved";
                               bpm_package.children[i].save();
                           }
                        }
                     </activiti:string>
                  </activiti:field>
               </activiti:taskListener>
            </extensionElements>
            <humanPerformer>
                <resourceAssignmentExpression>
                    <formalExpression>${initiator.properties.userName}</formalExpression>
                </resourceAssignmentExpression>
            </humanPerformer>
        </userTask>

        <userTask id="rejected" name="Reimbursement Rejected"
            activiti:formKey="wf:rejectedTask" >
            <documentation>
                The reimbursement was reviewed and rejected.
            </documentation>
            <extensionElements>
               <activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
                  <activiti:field name="script">
                     <activiti:string>

                        for (var i = 0; i &lt; bpm_package.children.length; i++)
                        {
                           if (bpm_package.children[0].hasAspect("rei:status"))
                           {
                              bpm_package.children[i].properties["rei:status"] = "Draft";
                              bpm_package.children[i].save();
                           }
                        }
                     </activiti:string>
                  </activiti:field>
               </activiti:taskListener>
            </extensionElements>
            <humanPerformer>
                <resourceAssignmentExpression>
                    <formalExpression>${initiator.properties.userName}</formalExpression>
                </resourceAssignmentExpression>
            </humanPerformer>
        </userTask>

        <sequenceFlow id='flow6' sourceRef='approved'
            targetRef='end' />

        <sequenceFlow id='flow7' sourceRef='rejected'
            targetRef='end' />

        <endEvent id="end" />



    </process>

</definitions>

我的模型文件是

<?xml version="1.0" encoding="UTF-8"?>

<model name="rei:workflowreimburmodel" xmlns="http://www.alfresco.org/model/dictionary/1.0">

    <!-- Optional meta-data about the model -->
    <description>Workflow reimbur Model</description>
    <author></author>
    <version>1.0</version>

   <imports>
        <import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d" />
        <import uri="http://www.alfresco.org/model/content/1.0" prefix="cm" />
        <import uri="http://www.alfresco.org/model/bpm/1.0" prefix="bpm" />
        <import uri="http://www.alfresco.org/model/user/1.0" prefix="usr" />
        <import uri="http://www.alfresco.org/model/workflow/1.0" prefix="wf" />
    </imports>

    <namespaces>
        <namespace uri="rei.model" prefix="rei" />
    </namespaces>

    <constraints>
        <constraint name="rei:status" type="LIST">
            <parameter name="allowedValues">
                <list>
                    <value>Draft</value>
                    <value>In Review</value>
                    <value>Approved</value>
                </list>
            </parameter>
        </constraint>
    </constraints>   

     <types>
        <type name="rei:reimbursubmitReviewTask">
            <title>Submit Reimbursement Application</title>
            <parent>wf:submitReviewTask</parent>
             <mandatory-aspects>
               <aspect>rei:myAspect</aspect>
            </mandatory-aspects>
         </type>
         <type name="rei:reimburactivitiReviewTask">
            <parent>wf:activitiReviewTask</parent>
             <mandatory-aspects>
               <aspect>rei:myAspect</aspect>
            </mandatory-aspects>
         </type>
    </types>

    <aspects>
        <!-- Status property is used to manage workflow approval -->
        <aspect name="rei:status">
            <title>Status</title>
            <properties>
                <property name="rei:status">
                    <title>Status</title>
                    <type>d:text</type>
                    <default>Draft</default>
                    <constraints>
                        <constraint ref="rei:status" />
                    </constraints>
                </property>
            </properties>
        </aspect>
        <aspect name="rei:myAspect">
             <title>My Aspect</title>
             <properties>               
                <property name="rei:workflowAmount">
                   <type>d:float</type>
                   <mandatory>true</mandatory>
                </property>                     
             </properties>
        </aspect>

    </aspects>  



</model>

我的 share-congif-form 文件是

 <config evaluator="string-compare" condition="activiti$activitireimburApproval">
      <forms>
         <form>
            <field-visibility>
               <show id="bpm:workflowDescription" />
               <show id="rei:workflowAmount" />
               <show id="bpm:assignee" />
               <show id="bpm:sendEMailNotifications" />
            </field-visibility>
            <appearance>
               <set id="" appearance="title" label-id="workflow.set.general" />
               <set id="info" appearance="" template="/org/alfresco/components/form/3-column-set.ftl" />
               <set id="assignee" appearance="title" label-id="workflow.set.assignee" />
               <set id="other" appearance="title" label-id="workflow.set.other" />

               <field id="bpm:workflowDescription" label-id="Expenditure was for" mandatory="true">
                  <control template="/org/alfresco/components/form/controls/textarea.ftl">
                     <control-param name="style">width: 95%</control-param>
                  </control>
               </field>
               <field id="rei:workflowAmount" label-id="Amount ($)" set="info" mandatory="true">
                  <control template="/org/alfresco/components/form/controls/textfield.ftl">
               </control>
               </field>
              <field id="bpm:assignee" label-id="workflow.field.reviewer" set="assignee" />
               <field id="bpm:sendEMailNotifications" set="other" read-only="true">
                  <control template="/org/alfresco/components/form/controls/workflow/email-notification.ftl" />
               </field>
            </appearance>
         </form>
      </forms>
   </config>


    <config evaluator="task-type" condition="rei:reimbursubmitReviewTask">
      <forms>
         <form id="workflow-details">
            <field-visibility>
               <show id="bpm:sendEMailNotifications" />
            </field-visibility>
            <appearance>
               <set id="" appearance="title" label-id="workflow.set.workflow.more_info" />
            </appearance>
         </form>

         <form>
            <field-visibility>
               <show id="message" />
               <show id="taskOwner" />
               <show id="bpm:taskId" />
               <show id="bpm:status" />
               <show id="rei:workflowAmount" />
               <show id="bpm:assignee" />
               <show id="bpm:sendEMailNotifications" />
            </field-visibility>
            <appearance>
               <set id="" appearance="title" label-id="workflow.set.task.info" />
               <set id="info" appearance="" template="/org/alfresco/components/form/3-column-set.ftl" />
               <set id="other" appearance="title" label-id="workflow.set.other" />

               <field id="message">
                  <control template="/org/alfresco/components/form/controls/info.ftl" />
               </field>
               <field id="taskOwner" set="info" />
               <field id="bpm:taskId" set="info">
                  <control template="/org/alfresco/components/form/controls/info.ftl" />
               </field>
              <field id="rei:workflowAmount" set="info" label-id="Amount ($)">
                  <control template="/org/alfresco/components/form/controls/info.ftl" />
               </field>

               <field id="bpm:assignee" label-id="workflow.field.assign_to" set="assignee" />
               <field id="bpm:status" set="progress" />
               <field id="bpm:sendEMailNotifications" set="other" />
            </appearance>
         </form>
      </forms>
   </config>  

   <config evaluator="task-type" condition="rei:reimburactivitiReviewTask">
      <forms>
         <form>
            <field-visibility>
               <show id="message" />
               <show id="taskOwner" />
               <show id="bpm:assignee" />
               <show id="rei:workflowAmount" />
               <show id="bpm:taskId" />
               <show id="bpm:status" />
               <show id="bpm:comment" />
               <show id="wf:reviewOutcome" />
            </field-visibility>
            <appearance>
               <set id="" appearance="title" label-id="workflow.set.task.info" />
               <set id="info" appearance="" template="/org/alfresco/components/form/3-column-set.ftl" />
               <set id="response" appearance="title" label-id="workflow.set.response" />

               <field id="message">
                  <control template="/org/alfresco/components/form/controls/info.ftl" />
               </field>
               <field id="taskOwner" set="info" />
               <field id="bpm:taskId" set="info">
                  <control template="/org/alfresco/components/form/controls/info.ftl" />
               </field>
               <field id="rei:workflowAmount" set="info" label-id="Amount ($)">
                  <control template="/org/alfresco/components/form/controls/info.ftl" />
               </field>
               <field id="bpm:status" set="progress" />
               <field id="bpm:assignee" label-id="workflow.field.assign_to" set="assignee" />
               <field id="bpm:comment" label-id="workflow.field.comment" set="response">
                  <control template="/org/alfresco/components/form/controls/textarea.ftl" />
               </field>
               <field id="wf:reviewOutcome" label-id="workflow.field.outcome" set="response">
                  <control template="/org/alfresco/components/form/controls/workflow/activiti-transitions.ftl" />
               </field>
            </appearance>
         </form>
      </forms>
   </config>

在上述文件中,我想让受理人字段出现在第一个审批人表单中,以便他/她可以将其分配给第二个审批人。但是我没有在任务/工作流程描述窗口上看到,并且在批准/拒绝之后,工作流程不会转到第二个批准者,而是返回到发起者。

我究竟做错了什么?请指导我。

提前致谢。

4

1 回答 1

0

好吧,我不使用共享,但是如果我理解得很好,您应该首先批准“userTask id =“reviewtask”指向“reviewtask2”

所以在这里:

 <sequenceFlow id='flow4' sourceRef='reviewDecision' targetRef='approved' >
            <conditionExpression xsi:type="tFormalExpression">${wf_reviewOutcome == 'Approve'}</conditionExpression>
        </sequenceFlow>

应该:

 <sequenceFlow id='flow4' sourceRef='reviewDecision' targetRef='reviewTask2' >
            <conditionExpression xsi:type="tFormalExpression">${wf_reviewOutcome == 'Approve'}</conditionExpression>
        </sequenceFlow>

在 reviewTask2 结束时:

 <humanPerformer>
            <resourceAssignmentExpression>
                <formalExpression>${initiator.properties.userName}</formalExpression>
            </resourceAssignmentExpression>
        </humanPerformer>

也许你需要在这里和那里进行一些调整,但逻辑应该没问题..如果没问题,请告诉我。

于 2013-11-18T16:15:06.107 回答