ScriptFacade:addFieldButton 扩第3参闭包(onClick 子指令数组)+ showConfirm 新动词,服务端急切求值闭包,子指令收进子缓冲,输出嵌套指令 JSON。 前端 scriptCommands.ts/registerReplayAction.ts:处理 addButton onClick/ confirmDialog onOk 嵌套重放,onClickActions/onOkActions 透传给 amis。 ScriptFacadeTest 补 7 个正反例(24/24 全绿)。 staging 晋级:FULL_AUTO 507(+10)/HARD 74(-12)/自动化率 82.7%, 双库各更新 801 条,e2e 30/30 全绿。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
79 lines
3.0 KiB
Groovy
79 lines
3.0 KiB
Groovy
// === EIP4 P4 脚本迁移产出 ===
|
||
// template_id : fb51a8c9-3bd4-4517-b19f-74edcc34f8f7
|
||
// template_name: 发薪/扣款计划
|
||
// seq : 1
|
||
// label : HARD
|
||
// 硬 S3 原因 : 动态创建 Vaadin Button(无法自动改写形态)
|
||
// 处置 : 原文保留,进人工排期(amis dialog/service 重写)
|
||
import com.vaadin.ui.Button;
|
||
import com.vaadin.ui.Button.ClickListener;
|
||
import com.vaadin.ui.Notification;
|
||
import com.vaadin.ui.Notification.Type;
|
||
import com.vaadin.ui.Button.ClickEvent;
|
||
Button button = new Button("生成明细");
|
||
|
||
|
||
def mgroup = group;
|
||
button.addClickListener(new ClickListener() {
|
||
@Override
|
||
public void buttonClick(ClickEvent event) {
|
||
|
||
def totalmoney = getFieldValue("TOTALMONEY");
|
||
def monthsize = getFieldValue("MONTHSIZE");
|
||
def monthspace = getFieldValue("MONTHSPACE");
|
||
def startmonth = getFieldValue("STARTMONTH");
|
||
def startyear = getFieldValue("STARTYEAR");
|
||
if(monthsize == null){
|
||
Notification.show("请输入月数!", Type.ERROR_MESSAGE);
|
||
return;
|
||
}
|
||
if(monthspace == null){
|
||
Notification.show("请输入间隔月数!", Type.ERROR_MESSAGE);
|
||
return;
|
||
}
|
||
|
||
if(startyear == null){
|
||
Notification.show("请输入开始年!", Type.ERROR_MESSAGE);
|
||
return;
|
||
}
|
||
if(startmonth == null){
|
||
Notification.show("请输入开始月!", Type.ERROR_MESSAGE);
|
||
return;
|
||
}
|
||
if(totalmoney == null){
|
||
Notification.show("请输入总额!", Type.ERROR_MESSAGE);
|
||
return;
|
||
}
|
||
if(monthspace >=12){
|
||
Notification.show("间隔月数要小于12!", Type.ERROR_MESSAGE);
|
||
return;
|
||
}
|
||
if(totalmoney >0){
|
||
def m = totalmoney/monthsize;
|
||
def details = [];
|
||
def syear = startyear;
|
||
def smonth = startmonth;
|
||
for(int i=0;i<monthsize;i++){
|
||
def detailitem = [:];
|
||
detailitem["YEAR"]= syear;
|
||
detailitem["MONTH"]= smonth;
|
||
detailitem["MONEY"]= m;
|
||
details.add(detailitem);
|
||
smonth=smonth+1+monthspace;
|
||
if(smonth>12){
|
||
smonth=1;
|
||
syear++;
|
||
}
|
||
}
|
||
|
||
if(details.size()>0){
|
||
bindField("PLANDETAILS",details)
|
||
}
|
||
}
|
||
|
||
}
|
||
})
|
||
|
||
|
||
group.getField("ADDDETAIL")?.parent?.addComponent(button);
|
||
|