
# 保存申请单草稿 - SaveAsDraft
#### 功能介绍
保存申请单草稿。
#### 授权信息
账号具备所有API的调用权限，如果使用账号下的IAM用户调用当前API，该IAM用户需具备调用API所需的权限，具体权限要求请参见[权限和授权项](https://support.huaweicloud.com/api-craftartsipdcenter/ipdcenter_06_0034.html)。
#### URI
POST /console/servicetask/api/localMethod/save_process_draft/saveAsDraftNew
示例接口地址：{域名（有文根需带文根）}/pdmcore/ipdcworkflowservice/console/servicetask/api/localMethod/save_process_draft/saveAsDraftNew
#### 请求头
使用机机认证调用接口时需传入header：Authorization，其值为机机鉴权token。
#### 请求参数
表1请求Body参数 
| 参数                   | 是否必选 | 参数类型                                                                                                          | 描述   |
|:---|:---|:---|:---|
| DefinitionArrayParam | 否    | Array of [DefinitionArrayParam] objects | 请求参数 |
   
 表2DefinitionArrayParam 
| 参数        | 是否必选 | 参数类型             | 描述                                           |
|:---|:---|:---|:---|
| blockId   | 否    | String           | 区块ID或页面组件的ref                                |
| nodeId    | 否    | String           | 节点ID                                         |
| blockType | 否    | String           | 区块类型：xdm/业务组件serverKey，为xdm时需要将数据保存到xdm对应模块中 |
| data      | 否    | JSONArray object | 携带模型数据                                       |
   
 表3blockType详细示例 
| blockType类型        | 含义    | 示例                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
|:---|:---|:---|
| start_process      | 发起流程  | { "blockType": "start_process", "nodeId": "", "blockId": "", "data": \[ { "processTemplateName": "Test_file_0426", "processTemplateVersion": "1", "businessKey": "P10159322" } \] }                                                                                                                                                                                                                                                                                                                                                    |
| save_process_draft | 保存草稿  | { "blockType": "save_process_draft", "nodeId": "", "blockId": "", "data": \[ { "processTemplateName": "Test_file_0426", "processTemplateVersion": "1", "businessKey": "P10159322" } \] }                                                                                                                                                                                                                                                                                                                                       |
| attachment         | 附件    | { "nodeId": "StartEvent_1", "blockType": "attachment", "blockId": "67c0f8e6", "data": \[ { "id": "626744214796914688", "nodeId": "StartEvent_1", "size": "44894", "fileName": "测试上传.xlsx", "nodeName": "启动流程", "uploadTime": 1714448265168, "taskId": "", "creator": "XDM_Developer" } \] } |
| participant        | 设置参与者 | { "nodeId": "StartEvent_1", "blockType": "participant", "blockId": "256cf56f", "data": \[ { "MiserableCoder": "93172bbfd0f64437956d4c9de9345386" } \] }                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| xdm模型名称            | xdm模型 | { "nodeId": "StartEvent_1", "blockType": "CadInfo", "blockId": "6f305382", "data": \[ { "checkInOrCheckOutText": "123456" } \] }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
   
#### 响应参数
**状态码： 200**
表4响应Body参数 
| 参数      | 参数类型                                                                                | 描述      |
|:---|:---|:---|
| code    | Integer                                                                             | 接口返回码   |
| data    | [Data] object | 接口响应数据  |
| orderID | String                                                                              | 请求跟踪流水号 |
   
 表5Data 
| 参数                     | 参数类型                   | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
|:---|:---|:---|
| currentUserCN          | String                 | 当前用户                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| lastUpdateDate         | Integer                | 最新修改时间                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| modifier               | String                 | 修改人UUID                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| processTemplateName    | String                 | 流程模板名称                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| templateId             | String                 | 流程模板编号                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| currentUserUuid        | String                 | 当前用户UUID                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| bizSeqExtAttrs         | Array of strings       | 业务对象拓展属性集合                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| lastUpdateUserCN       | String                 | 最新修改用户                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| processTitle           | String                 | 流程实例名称                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| bizSeqExtType          | String                 | 业务对象拓展类型名称                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| state                  | String                 |  任务状态： - SUSPENDED挂起  - ACTIVE已完成  - COMPLETED取消  - INTERNALLY_TERMINATED取消   |
| creationUserCN         | String                 | 创建用户                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| lastUpdatedBy          | Integer                | 最新更新人                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| creator                | String                 | 创建人UUID                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| processTemplateVersion | String                 | 流程模板版本                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| finished               | Boolean                | 流程是否完成                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| creationDate           | Integer                | 创建日期                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| creationUserUuid       | String                 | 创建人UUID                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| createdBy              | Integer                | 创建人                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| businessSeqView        | BusinessSeqView object | -                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| appName                | String                 | -                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| entityType             | String                 | -                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| holdableList           | Array of strings       | -                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| holderId               | Integer                | -                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| businessKey            | String                 | -                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| holderType             | String                 | -                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| id                     | Integer                | -                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
   
表6BusinessSeqView 
| 参数                      | 参数类型             | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
|:---|:---|:---|
| wfBusinessObjectList    | Array of strings | -                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| rdmDeleteFlag           | Integer          | -                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| wfTeamGroupMemberList   | Array of strings | -                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| modifier                | String           | -                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| processTemplateName     | String           | -                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| className               | String           | -                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| wfHiSimpleDiagramList   | Array of strings | -                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| processTitle            | String           | -                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| id                      | Long             | -                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| state                   | String           | 任务状态： - SUSPENDED挂起  - ACTIVE已完成  - COMPLETED取消  - INTERNALLY_TERMINATED取消    |
| wfFormdataList          | Array of strings | -                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| tenant                  | Tenant object    | -                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| rdmVersion              | Integer          | -                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| creator                 | String           | -                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| wfAttachmentInfoList    | Array of strings | -                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| processTemplateVersion  | String           | -                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| wfHiProcessVariableList | Array of strings | -                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| wfHiTaskUserList        | Array of strings | -                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| wfHiProcessInstanceList | Array of strings | -                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| createTime              | Long             | -                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| wfHiTaskInfoList        | Array of strings | -                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| businessKey             | String           | -                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| rdmExtensionType        | String           | -                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| wfTaskReviewList        | Array of strings | -                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| extAttrs                | Array of strings | -                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| lastUpdateTime          | Long             | -                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
   
表7 
| 参数               | 参数类型    | 描述 |
|:---|:---|:---|
| rdmVersion       | Integer | -  |
| creator          | String  | -  |
| code             | String  | -  |
| rdmDeleteFlag    | Integer | -  |
| modifier         | String  | -  |
| description      | String  | -  |
| className        | String  | -  |
| securityLevel    | String  | -  |
| createTime       | Long    | -  |
| disableFlag      | Boolean | -  |
| name             | String  | -  |
| rdmExtensionType | String  | -  |
| id               | Integer | -  |
| dataSource       | String  | -  |
| lastUpdateTime   | Long    | -  |
   
#### 请求示例
```
[{
"blockType": "start_process",
"nodeId": "",
"blockId": "",
"data": [{
"processTemplateName": "Test0425",
"processTemplateVersion": "4"
}]
}, {
"nodeId": "StartEvent_1",
"blockType": "participant",
"blockId": "256cf56f",
"data": [{
"mainReview": "05209014da3a49faa68056102da7ba35"
}]
}, {
"nodeId": "StartEvent_1",
"blockType": "attachment",
"blockId": "67c0f8e6",
"data": []
}, {
"nodeId": "StartEvent_1",
"blockType": "EcChangeTypeTemplate",
"blockId": "fee5a374",
"data": [{
"EcChangeType": "11",
"Version": "22"
}]
}]
```
#### 响应示例
**状态码： 200**
接口返参
```
{
    "code": 0,
    "data": {
        "currentUserCN": "sysadmin",
        "lastUpdateDate": 1742974403256,
        "modifier": "1000001",
        "processTemplateName": "Test20250326001",
        "templateId": "Test20250326001",
        "currentUserUuid": "1000001",
        "businessSeqView": {
            "wfBusinessObjectList": [],
            "rdmDeleteFlag": 0,
            "wfTeamGroupMemberList": [],
            "modifier": "1000001",
            "processTemplateName": "Test20250326001",
            "className": "WfBusinessSeq",
            "wfHiSimpleDiagramList": [],
            "processTitle": "Test20250326001_2025-03-26T15:33:23.188+0800",
            "id": 746391509842026496,
            "state": "DRAFT",
            "wfFormdataList": [],
            "tenant": {
                "rdmVersion": 1,
                "creator": "xdmAdmin",
                "code": "basicTenant",
                "rdmDeleteFlag": 0,
                "modifier": "xdmAdmin",
                "description": "默认租户",
                "className": "Tenant",
                "securityLevel": "internal",
                "createTime": 1742817667895,
                "disableFlag": false,
                "name": "basicTenant",
                "rdmExtensionType": "Tenant",
                "id": -1,
                "dataSource": "DefaultDataSource",
                "lastUpdateTime": 1742817667895
            },
            "rdmVersion": 1,
            "creator": "1000001",
            "wfAttachmentInfoList": [],
            "processTemplateVersion": "1",
            "wfHiProcessVariableList": [],
            "wfHiTaskUserList": [],
            "wfHiProcessInstanceList": [],
            "createTime": 1742974403256,
            "wfHiTaskInfoList": [],
            "businessKey": "P10000029",
            "rdmExtensionType": "WfBusinessSeq",
            "wfTaskReviewList": [],
            "extAttrs": [],
            "lastUpdateTime": 1742974403256
        },
        "bizSeqExtAttrs": [],
        "lastUpdateUserCN": "1000001",
        "processTitle": "Test20250326001_2025-03-26T15:33:23.188+0800",
        "bizSeqExtType": "WfBusinessSeq",
        "id": "746391509842026496",
        "state": "DRAFT",
        "creationUserCN": "1000001",
        "lastUpdatedBy": "1000001",
        "creator": "1000001",
        "appName": "IpdcWorkflowService",
        "entityType": "business",
        "processTemplateVersion": "1",
        "holdableList": [
            "com.huawei.it.plm.workflow.framework.model.WfFormData",
            "com.huawei.it.plm.workflow.framework.model.WfAttachment",
            "com.huawei.it.plm.workflow.framework.model.WfBusinessObject"
        ],
        "finished": false,
        "creationDate": 1742974403256,
        "creationUserUuid": "1000001",
        "holderId": 746391509842026496,
        "createdBy": "1000001",
        "businessKey": "P10000029",
        "holderType": "business"
    },
    "orderID": "5f1bd468-d34f-4756-a20b-125d4472fa09"
}
```
#### 状态码
| 状态码 | 描述   |
|:---|:---|
| 200 | 接口返参 |
   
#### 错误码
请参见[错误码](https://support.huaweicloud.com/api-craftartsipdcenter/ErrorCode.html)。
#### 使用说明
如果需要获得正常的反参，则需在页面上运行一个真实存在的流程，单击保存草稿按钮，从接口中取得相应的入参。否则接口返回是200，返回信息中不会有真实模板的信息。
