# 常用事件脚本说明

表单的事件包含两种：一种是表单容器对应的DIV对象的DOM事件，一种是表单系统事件。 表单系统事件如下表：

\
表单系统事件如下表：

| **事件名**                                    | **描述**                                                                                   |
| ------------------------------------------ | ---------------------------------------------------------------------------------------- |
| beforeLoad                                 | 表单被载入之前执行。                                                                               |
| <p>afterLoad</p><p>load</p><p>postLoad</p> | 表单被完全载入之后执行                                                                              |
| beforeSave                                 | 在用户点击“保存”按钮，或执行this.form.save方法，而数据没有真正被保存之前。在表单执行流转的过程中，会先对表单数据进行保存，所以也会触发beforeSave事件。 |
| afterSave                                  | 在用户点击“保存”按钮，或执行this.form.save方法，数据被保存成功之后。在表单执行流转的过程中，会先对表单数据进行保存，所以也会触发afterSave事件。     |
| beforeClose                                | 表单窗口被关闭之前。                                                                               |
| <p>submit</p><p>beforeProcess</p>          | 在表单继续流转之前执行（已经填写意见和选择决策）。点击“继续流转”按钮，或执行this.from.process方法，都会触发此事件。                      |
| beforeProcessWork                          | 在表单继续流转之前执行，与submit和beforeProcess不同的是，beforeProcessWork是在填写意见和选择决策窗口弹出之前执行的。             |
| afterProcess                               | 在表单执行流转成功之后执行。                                                                           |
| beforeReset                                | 在执行重置处理人操作之前执行。                                                                          |
| afterReset                                 | 在执行重置处理人操作之后执行。                                                                          |

| beforeRetract     | 在执行撤回操作之前执行。                                      |
| ----------------- | ------------------------------------------------- |
| afterRetract      | 在执行撤回操作之后执行。                                      |
| beforeReroute     | 在执行调度操作之前执行。                                      |
| afterReroute      | 在执行调度操作之后执行。                                      |
| beforeModulesLoad | 在表单已载入,但表单中的元素未载入之时执行。                            |
| afterModulesLoad  | 在表单中的所有元素载入之后执行。实际执行时间与afterLoad、load、postLoad相同。 |
| resize            | 在表单所在容器的大小发生变化时执行。                                |
| beforeDelete      | 在执行删除操作之前执行。                                      |

　　表单容器的DOM事件请参考相关HTML规范。可参考：\
&#x20;　　[MDN: HTMLDivElement](https://developer.mozilla.org/zh-CN/docs/Web/API/HTMLDivElement)

　　关于事件的详细编写方法，请参阅《O2OA开发API文档》。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://o2oa.gitbook.io/course/liu-cheng-guan-li/liu-cheng-ying-yong-kai-fa-yu-she-ji/chang-yong-shi-jian-jiao-ben-shuo-ming.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
