Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

表单

  1. 添加一个  隐藏的字段 到第一个窗体,设置ID 为“ID”,并将下面的值添加到  默认值。第一种表单是指在流程活动映射中映射到  运行流程实体的表单。

Form

  1. Add a Hidden Field to the first form, set the ID to "id" and add in the following value into Default Value. The first form meant here is the one that it mapped to the Run Process entity in the process activity mapping.

    Code Block
    #requestParam.recordId#

    This is so that, if there's existing record being loaded, when the new process instance is created, the process instance will refer to this very record subsequently.

    这样,如果加载了现有记录,则在创建新流程实例时,流程实例将随后引用该记录。

  2. 在相同的表单,创建一个新的分区,保持空白。编辑该部分,将加载绑定器 设置  为  Bean Shell表单绑定器。将下面的代码插入它。In the same form, create a new section, leave it empty. Edit the section, set the Load Binder to Bean Shell Form Binder. Insert the following code into it.

    Code Block
    import org.joget.apps.form.lib.SaveAsDraftButton;
    import org.joget.apps.form.lib.CustomHTML;
    import org.joget.apps.form.model.Column;
    import org.joget.apps.form.model.Element;
    import org.joget.apps.form.model.FormAction;
    import org.joget.apps.form.model.FormData;
    import org.joget.apps.form.model.Section;
    import org.joget.apps.form.service.FormUtil;
    import java.util.ArrayList;
    import java.util.Collection;
    Collection formActions = new ArrayList();
    String saveButtonLabel = "Save As Draft";
    Element saveButton = new SaveAsDraftButton();
    saveButton.setProperty(FormUtil.PROPERTY_ID, "saveAsDraft");
    saveButton.setProperty("label", saveButtonLabel);
    formActions.add(saveButton);
    Section section = element;
    ArrayList columns = (ArrayList) section.getChildren();
    Column column = columns.get(0);
    column.setProperty("horizontal", "true");
    column.setChildren(formActions);
    //add a custom html to fix the layout issue
    Element html = new CustomHTML();
    String script = "<script>$(document).ready(function(){";
    script += "$(\"#"+section.getPropertyString("id")+"\").find(\".form-cell\").prependTo(\"#section-actions .form-column\");";
    script += "$(\"#"+section.getPropertyString("id")+"\").remove();";
    script += "});</script>";
    html.setProperty("id", "button_layout_fixes");
    html.setProperty("label", "");
    html.setProperty("value", script);
    formActions.add(html);
    return null;

Userview

用户视图

  1. 在用户视图中,添加一个  运行流程,将自定义ID 命名为  “ startApplication ”。正确设置标签,例如“ 启动应用程序 ”In the Userview, add a Run Process, name the Custom ID to something meaningful, e.g. "startApplication". Set the label appropriately, e.g. "Start Application".

    Info
    titleWhy are we doing this?

    This is so that user can start a new process instance.

    我们为什么这么做?

    这样用户可以启动一个新的流程实例。

  2. 添加一个列表/ CRUD到用户视图中,在Datalist Builder中编辑列表,添加超链接 动作。正确设置标签,例如“ 申请草案 ”。
    1. 将超链接 设置  为“ startApplication ”(与 前面步骤1 中的“ 自定义ID”中设置的值相同)。
    2. 在超链接参数中,添加一个新的行 - 参数名称为“ recordId ”,列名称为“ id ”。
    3. 将标签设置为“ 编辑 ”。

     

    Info
    title我们为什么这么做?

    这样用户就可以访问他们已经启动的草稿应用程序。

    Info
    title下一步做什么?

    该列表可能会显示所有其他用户启动的所有草稿。您可能想要编辑Datalist Builder中的列表,以仅显示发起它的人的条目。请参阅高级表单绑定器了解如何过滤列表。

    Add a List/CRUD into the Userview, edit the list in Datalist Builder, add in a Hyperlink action. Set the label appropriately, e.g. "Application Draft".
    1. Set Hyperlink to "startApplication" (the same value that we set in Custom ID in Step 1 earlier).
    2. In Hyperlink Parameters, add a new row - parameter name as "recordId", column name as "id".
    3. Set the label to "Edit".

    Info
    titleWhy are we doing this?

    This is so that user can access the drafts applications that they have already started.

    Info
    titleWhat's next?

    The list may be showing all the drafts started by all other users. You may want to edit the list in Datalist Builder to only show entries from the person that initiated it. See 高级表单绑定器 on how to filter the list.