# 打开流程{docsify-ignore-all}
>打开流程时，在内存中处于空闲状态的流程会变成活跃状态，打开流程所需流程实例id和流程路径id在创建流程返回结果中可以查看得到

接口请求调用说明 <br>
http请求方式: POST <br>
请求地址: http://127.0.0.1:8080/demo/horizon/workflow/rest/flow/support/open.wf <br>
**post数据说明：**
```
{
  "accessToken": "",
  "workId": "",
  "trackId": "",
  "subjection": ""
}
```
请求参数说明:

| 参数          | 是否必须 | 描述                                                                                                                   |
|-------------|------|----------------------------------------------------------------------------------------------------------------------|
| accessToken | 是    | 调用接口凭证，唯一用户标识                                                                                                        |
| workId      | 是    | 流程实例id                                                                                                               |
| trackId     | 是    | 流程路径id                                                                                                               |
| subjection  | 否    | 当前用户所属的集合id(比如:部门 id，群组 id，岗位 id 等)<br> 打开流程时传入此字段（当打开人属于多身份时，<br/>以主办身份打开，该字段必传）<br>格式为：D_xxxid  G_xxxxid  P_xxxxid |
**返回结果示例：**
```
{
  "authorKey": "Author",
  "flowButtons": [
    {
      "buttonClass": "com.horizon.wf.action.ActionStop",
      "buttonFun": "",
      "buttonId": "stop",
      "buttonName": "终止",
      "icon": ""
    },
    {
      "buttonClass": "com.horizon.wf.action.ActionSubmitForFree",
      "buttonFun": "",
      "buttonId": "freesubmit",
      "buttonName": "自由提交",
      "icon": ""
    },
    {
      "buttonClass": "com.horizon.wf.action.ActionReject",
      "buttonFun": "",
      "buttonId": "reject",
      "buttonName": "退回",
      "icon": ""
    },
    {
      "buttonClass": "com.horizon.wf.action.ActionSubmit",
      "buttonFun": "",
      "buttonId": "submit",
      "buttonName": "提交",
      "icon": ""
    },
    {
      "buttonClass": "com.horizon.wf.action.ActionSave",
      "buttonFun": "",
      "buttonId": "save",
      "buttonName": "暂存",
      "icon": ""
    },
    {
      "buttonClass": "com.horizon.wf.action.ActionHuiQian",
      "buttonFun": "",
      "buttonId": "huiqian",
      "buttonName": "发起会签",
      "icon": ""
    },
    {
      "buttonClass": "com.horizon.wf.action.ActionGoto",
      "buttonFun": "",
      "buttonId": "goto",
      "buttonName": "跳转",
      "icon": ""
    },
    {
      "buttonClass": "com.horizon.wf.action.ActionAddReader",
      "buttonFun": "",
      "buttonId": "addreader",
      "buttonName": "发送阅知",
      "icon": ""
    },
    {
      "buttonClass": "com.horizon.wf.action.ActionPause",
      "buttonFun": "",
      "buttonId": "pause",
      "buttonName": "暂停",
      "icon": ""
    },
    {
      "buttonClass": "com.horizon.wf.action.ActionAddSecondAuthor",
      "buttonFun": "",
      "buttonId": "addSecondauthor",
      "buttonName": "增加协办",
      "icon": ""
    },
    {
      "buttonClass": "com.horizon.wf.action.ActionRejectByJump",
      "buttonFun": "",
      "buttonId": "jumpreject",
      "buttonName": "任意退回",
      "icon": ""
    },
    {
      "buttonClass": "com.horizon.wf.action.ActionStartMultiSubFlow",
      "buttonFun": "",
      "buttonId": "subflow",
      "buttonName": "启动子流程",
      "icon": ""
    },
    {
      "buttonClass": "com.horizon.wf.action.ActionReMsg",
      "buttonFun": "",
      "buttonId": "urge",
      "buttonName": "催办",
      "icon": ""
    },
    {
      "buttonClass": "com.horizon.wf.action.ActionCancel",
      "buttonFun": "",
      "buttonId": "cancel",
      "buttonName": "撤办",
      "icon": ""
    },
    {
      "buttonClass": "com.horizon.wf.action.ActionReplaceAuthor",
      "buttonFun": "",
      "buttonId": "replace",
      "buttonName": "替换处理人",
      "icon": ""
    }
  ],
  "flowForms": [
    {
      "formAuthId": "alleditable",
      "formBody": "",
      "formButton": "",
      "formDataId": "FlowTrack",
      "formDatas": "",
      "formFieldAuth": "",
      "formFields": "",
      "formId": "FlowTrack",
      "formName": "流程跟踪",
      "formType": "",
      "isDef": "true",
      "isNewData": "false"
    },
    {
      "formAuthId": "HZ28858f8137db82018137db82aa0000",
      "formBody": "",
      "formButton": "",
      "formDataId": "HZ28858f8137db820181380971db0046",
      "formDatas": "",
      "formFieldAuth": {
        "authName": "test_auth",
        "checkField": [
          "HZ28858f80b64b190180b64e3f8f0028_P2"
        ],
        "editField": [
          "HZ28858f80b64b190180b64e3f8f0028_P2",
          "HZ28858f80b64b190180b64e3f8f0028_NAME"
        ],
        "formId": "HZ28858f80b64b190180b64e3f8f0028",
        "hiddenField": [],
        "readField": [
          "HZ28858f80b64b190180b64e3f8f0028_P1"
        ]
      },
      "formFields": "",
      "formId": "HZ28858f80b64b190180b64e3f8f0028",
      "formName": "测试表单",
      "formType": "CUSTOM",
      "isDef": "",
      "isNewData": "true"
    }
  ],
  "flowId": "test",
  "flowMsg": "OK",
  "flowName": "新流程",
  "flowNode": {
    "memo": "",
    "nodeId": "Node1",
    "nodeName": "任务1",
    "nodeVars": {
      "testA": "10",
      "testB": "hello"
    },
    "trackId": "HZ28858f8137db82018137ebd76b0033"
  },
  "flowStatus": "110",
  "flowStatusName": "正常",
  "flowUser": {
    "author": "Author;Creator;Manager",
    "authorName": "主办;创建者;管理员",
    "deptId": "HZ28821856ef63420156ef63429c0000",
    "deptName": "慧正通软",
    "transactor":"admin",
    "transactorName": "管理员",
    "userId": "admin",
    "userName": "管理员"
  },
  "flowVars": {
    "varA": "10"
  },
  "hasForm": "true",
  "openType": "true",
  "selectNodes": "",
  "subjectionId": "",
  "workId": "HZ28858f8137db82018137ebd76b0032"
}
```
**结果参数说明:**

| 参数             | 参数类型   | 描述                                                                                                         |
|----------------|--------|------------------------------------------------------------------------------------------------------------|
| authorKey      | String | 当前办理人身份                                                                                                    |
| flowButtons    | List   | 流程操作按钮信息，详情可看flowButtons参数说明                                                                               |
| flowForms      | List   | 流程表单信息，详情可看flowForms参数说明                                                                                   |
| flowId         | String | 流程id                                                                                                       |
| flowMsg        | String | 流程返回信息                                                                                                     |
| flowName       | String | 流程名称                                                                                                       |
| flowNode       | Object | 当前节点信息，详情可看flowNode参数说明                                                                                    |
| flowUser       | Object | 流程执行的当前用户信息，详情可看flowUser参数说明                                                                               |
| flowStatus     | String | 流程状态<br>100:起草<br>110:正常<br>120:会签<br>130:退回<br>140:暂停<br>150:撤办<br>160:子流程<br>170:结束<br>180:终止<br>190:拿回; |
| flowStatusName | String | 流程状态显示名称                                                                                                   |
| flowVars       | Map    | 流程变量，key为变量名，value为变量值                                                                                     |
| hasForm        | String | 是否含有业务表单                                                                                                   |
| openType       | String | 流程打开状态                                                                                                     |
| selectNodes    | List   | 当前人处于多个活动节点时，需要选择节点打开实例                                                                                    |
| workId         | String | 流程实例id                                                                                                     |
| subjectionId   | String | 办理人所属范围                                                                                                    |
*flowButtons参数说明：*

| 参数          | 参数类型   | 描述      |
|-------------|--------|---------|
| buttonClass | String | 操作按钮实现类 |
| buttonFun   | String | 按钮事件    |
| buttonId    | String | 按钮id    |
| buttonName  | String | 按钮名称    |
| icon        | String | 按钮样式    |
*flowForms参数说明：*

| 参数            | 参数类型   | 描述                 |
|---------------|--------|--------------------|
| formAuthId    | String | 字段权限id             |
| formBody      | String | 表单内容               |
| formButton    | List   | 表单按钮               |
| formDataId    | String | 表单数据id             |
| formDatas     | Object | 表单数据(扩展字段，暂时用不到）   |
| formFieldAuth | Object | 表单字段权限信息           |
| formFields    | Object | 表单字段(扩展字段，暂时用不到）   |
| formId        | String | 表单id               |
| formName      | String | 表单名称               |
| formType      | String | 表单类型：<br>外部表单，定制表单 |
| isDef         | String | 是否是默认表单            |
| isNewData     | String | 是否为新的表单数据          |
*flowNode参数说明：*

| 参数       | 参数类型   | 描述                               |
|----------|--------|----------------------------------|
| memo     | String | 节点描述信息                           |
| nodeId   | String | 节点id                             |
| nodeName | String | 节点名称                             |
| nodeVars | Map    | 当前节点参数，key为变量名，value为变量值只在当前节点有效 |
| trackId  | String | 流转实例路径id                         |
*flowUser参数说明：*

| 参数             | 参数类型   | 描述                                        |
|----------------|--------|-------------------------------------------|
| author         | String | 用户身份id Author/SecondAuthor/Creator/Reader |
| authorName     | String | 用户身份名称主办/协办/创建者/读者                        |
| deptId         | String | 部门id                                      |
| deptName       | String | 部门名称                                      |
| transactor     | String | 正在办理人员id                                  |
| transactorName | String | 正在办理人员名称                                  |
| userId         | String | 用户id                                      |
| userName       | String | 用户名称                                      |
*formFieldAuth参数说明：*

| 参数          | 参数类型   | 描述                       |
|-------------|--------|--------------------------|
| authName    | String | 权限名                      |
| formId      | String | 表单id                     |
| editField   | List   | 可编辑字段，每一项为表单id + 关联表字段拼接 |
| checkField  | List   | 必填字段，每一项为表单id + 关联表字段拼接  |
| hiddenField | List   | 隐藏字段，每一项为表单id + 关联表字段拼接  |
| readField   | List   | 只读字段，每一项为表单id + 关联表字段拼接  |
