// === EIP4 P4 脚本迁移产出 === // template_id : a760fba0-693e-4f0a-8007-3bdca7fb0305 // template_name: 项目人员配置 // seq : 2 // label : HARD // 硬 S3 原因 : 动态创建 Vaadin 组件 // 处置 : 原文保留,进人工排期(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; final user = group.getField("PM_PROJECT_USERS"); final Button cb = new Button("删除"); final Object table = user?.table; table?.setImmediate(true);//设置验证 final group1 = group; cb?.addClickListener(new ClickListener() { public void buttonClick(ClickEvent event) { Object o = table?.getValue(); if (o == null){ Notification.show("请选择一条记录!", Type.ERROR_MESSAGE); return; } def isLock = getFieldValue(o, "ISLOCK"); if(isLock == 1){ Notification.show("已备案人员无法删除!", Type.ERROR_MESSAGE); }else{ table.removeItem(o); table.select(null); user.fireValueChange(true); } } }); //将自定义的按钮添加至 user?.addButton(cb,"delete.png", 1); user?.deleteButton.setVisible(false);