File tree Expand file tree Collapse file tree
src/components/flow-approval/components
flow-pc-design/src/components/design-panel Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # Groovy Script 脚本设计规范
2+
3+ ## 脚本的实例写法如下
4+ ```
5+ def run(request){
6+ return "Hello, ${request.name}!"
7+ }
8+ ```
9+
10+ ## 脚本规范
11+ request对象,根据脚本的不同,起传递的request对象也不同。
12+ return语句,return语句根据脚本的不同,起返回的对象也不同。
13+
14+ ## 开发规范
15+ 为了让脚本可以更好的呈现和使用,脚本的配置分为两种模式,一种是可视化配置模式,一种是代码配置模式。
16+
17+ * 代码配置模式
18+ 代码配置模式的脚本中,将会通过注释的方式添加一行@CUSTOM_SCRIPT,来标识这是一个自定义脚本,这样在编辑器中就会以代码的形式展示出来。
19+ ```
20+ // @CUSTOM_SCRIPT
21+ def run(request){
22+ return "Hello, ${request.name}!"
23+ }
24+ ```
25+
26+ * 可视化配置模式
27+ 可视化配置模式的脚本中,没有@CUSTOM_SCRIPT的注释标识,这样在编辑器中就会以可视化的形式展示出来。
28+ ```
29+ def run(request){
30+ return "Hello, ${request.name}!"
31+ }
32+ ```
33+
34+ ## 脚本展示标题
35+ 为了让脚本在在展示时可以更好的展示脚本的作用,所以在脚本中支持通过@SCRIPT_TITLE的注释来标识脚本的展示标题,这样在编辑器中就会以这个标题来展示脚本。
36+
37+ ```
38+ // @SCRIPT_TITLE 这是一个示例脚本
39+ def run(request){
40+ return "Hello, ${request.name}!"
41+ }
42+ ```
43+ 上述的脚本在编辑器中就会以“这是一个示例脚本”来展示,而不是以代码的方式来展示。
Original file line number Diff line number Diff line change 1313 "@flow-engine/flow-types" : " workspace:*" ,
1414 "@flow-engine/flow-pc-design" : " workspace:*" ,
1515 "@flow-engine/flow-pc-ui" : " workspace:*" ,
16- "@flow-engine/flow-pc-form" : " workspace:*" ,
1716 "@flow-engine/flow-pc-approval" :" workspace:*" ,
1817 "antd" : " ^6.2.1" ,
1918 "dayjs" : " ^1.11.19" ,
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -7,7 +7,6 @@ import zhCN from 'antd/locale/zh_CN';
77import dayjs from 'dayjs' ;
88import 'dayjs/locale/zh-cn' ;
99import "./index.css" ;
10- import "./config/plugin-view" ;
1110
1211dayjs . locale ( 'zh' ) ;
1312
Original file line number Diff line number Diff line change 2828 "@flow-engine/flow-types" : " workspace:*" ,
2929 "@flow-engine/flow-pc-design" : " workspace:*" ,
3030 "@flow-engine/flow-pc-ui" : " workspace:*" ,
31+ "@flow-engine/flow-pc-form" : " workspace:*" ,
3132 "@reduxjs/toolkit" : " ^2.11.2" ,
3233 "antd" : " ^6.2.1" ,
3334 "immer" : " ^11.1.3" ,
Original file line number Diff line number Diff line change @@ -2,14 +2,15 @@ import React from "react";
22import { useApprovalContext } from "@/components/flow-approval/hooks/use-approval-context" ;
33import { ViewBindPlugin } from "@flow-engine/flow-types" ;
44import { Form } from "antd" ;
5+ import { FlowFormView } from "@flow-engine/flow-pc-form" ;
56
67interface FormViewComponentProps {
78 onValuesChange ?:( values :any ) => void ;
89}
910
1011export const FormViewComponent : React . FC < FormViewComponentProps > = ( props ) => {
1112 const { state, context} = useApprovalContext ( ) ;
12- const ViewComponent = ViewBindPlugin . getInstance ( ) . get ( state . flow ?. view || 'default' ) ;
13+ const ViewComponent = ViewBindPlugin . getInstance ( ) . get ( state . flow ?. view || 'default' ) || FlowFormView ;
1314
1415 const formMeta = state . flow ?. form ;
1516
Original file line number Diff line number Diff line change @@ -117,6 +117,7 @@ export const initStateData: State = {
117117 id :'' ,
118118 title :'' ,
119119 code :'' ,
120+ operatorCreateScript :'' ,
120121 form :{
121122 code :'' ,
122123 name :'' ,
You can’t perform that action at this time.
0 commit comments