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>
70 lines
3.1 KiB
Groovy
70 lines
3.1 KiB
Groovy
// === EIP4 P4 脚本迁移产出 ===
|
||
// template_id : 5e618173-2ee1-406b-9829-28c58871316e
|
||
// template_name: 专业分包合同评审(五建定制)
|
||
// seq : 4
|
||
// label : HARD
|
||
// 硬 S3 原因 : 动态创建 Vaadin Button(无法自动改写形态)
|
||
// 处置 : 原文保留,进人工排期(amis dialog/service 重写)
|
||
import com.vaadin.ui.Button;
|
||
import com.vaadin.ui.Button.ClickEvent;
|
||
import com.vaadin.ui.Button.ClickListener;
|
||
import com.vaadin.ui.Notification;
|
||
import com.vaadin.ui.Notification.Type;
|
||
|
||
def contents = group.getField("CONTENTS");
|
||
final Object table = contents?.table;
|
||
table?.setImmediate(true);//设置验证
|
||
|
||
def opertor = group.getField("BUTTON");
|
||
def vl = opertor?.parent;
|
||
Button button = new Button("根据分包明细计算合同价款");
|
||
vl.addComponent(button,0);
|
||
button.addClickListener(new Button.ClickListener() {
|
||
@Override
|
||
public void buttonClick(Button.ClickEvent event) {
|
||
def balancedetails = getFieldValue("CONTENTS");
|
||
def sumamount = new BigDecimal("0");;
|
||
def summoney = new BigDecimal("0");;
|
||
if(balancedetails != null && balancedetails.size()>0){
|
||
balancedetails?.each{
|
||
if(it.get('VALENCE') !=null && it.get('VALENCE') !=""){
|
||
summoney = summoney.add(new BigDecimal(it.get('VALENCE')))
|
||
}
|
||
}
|
||
}
|
||
bindField("CONTRACTMONEY",summoney);
|
||
}
|
||
});
|
||
|
||
|
||
import com.dsasp.client.viewframework.util.TableImportExport;
|
||
def tie = new TableImportExport(contents,"com.dsasp.pm.specialtycontract.client.ContentsImport");
|
||
tie.addImportButton(2);
|
||
tie.addExportButton(3);
|
||
|
||
|
||
|
||
//带出金额
|
||
if(getFieldValue("PM_PROJECTID") != null){
|
||
def sql1 = "select coalesce(sum(p.CONTRACTMONEY),0) as TOTALCONTROLCOST from( ";
|
||
sql1 += "select case when c.pm_plannedcostchange_id is null then coalesce(pp.PROFESSIONALSUBCONTRACTCOST,0)";
|
||
sql1 += "else coalesce(c.PROFESSIONALSUBCONTRACTCOSTNOW,0) end as CONTRACTMONEY ";
|
||
sql1 += "from PM_PLANNEDCOSTDECLARATION pp ";
|
||
sql1 += "join SYS_DATASTATUS s on s.businesskey=pp.PM_PLANNEDCOSTDECLARATION_id and s.tablename = 'PM_PLANNEDCOSTDECLARATION'and s.DATASTATUS = 3 ";
|
||
sql1 += "left join lateral(select PM_PLANNEDCOSTCHANGE_id,PROFESSIONALSUBCONTRACTCOSTNOW,PM_PROJECTID ";
|
||
sql1 += "from PM_PLANNEDCOSTCHANGE p join SYS_DATASTATUS s on s.businesskey=p.PM_PLANNEDCOSTCHANGE_id ";
|
||
sql1 += "and s.tablename = 'PM_PLANNEDCOSTCHANGE'and s.DATASTATUS = 3 where p.PM_PROJECTID = pp.PM_PROJECTID order by p.CHANGEDATE desc,p.createtime desc limit 1)c on true ";
|
||
sql1 += " where pp.PM_PROJECTID = '"+getFieldValue("PM_PROJECTID")+"')p ";
|
||
def map1 = GetServicesFunction.executeQueryForMap(sql1);
|
||
if(map1 != null){
|
||
bindField("TOTALCONTROLCOST",map1.get("TOTALCONTROLCOST"));
|
||
};
|
||
def sql2 = "select coalesce(sum(v.CONTRACTMONEY),0) as TOTALCONTRACTMONEY from VIEW_PM_CONTRACT v ";
|
||
sql2 += "where v.CONTRACTTYPE = 2 and v.PM_PROJECT_ID = '"+getFieldValue("PM_PROJECTID")+"' ";
|
||
def map2 = GetServicesFunction.executeQueryForMap(sql2);
|
||
if(map2 != null){
|
||
bindField("TOTALCONTRACTMONEY",map2.get("TOTALCONTRACTMONEY"));
|
||
};
|
||
}
|
||
|