diff --git a/main/java/shkd/repc/rebm/formplugin/ControlFieldOnBizTypePlugin.java b/main/java/shkd/repc/rebm/formplugin/ControlFieldOnBizTypePlugin.java new file mode 100644 index 0000000..0cdd6c2 --- /dev/null +++ b/main/java/shkd/repc/rebm/formplugin/ControlFieldOnBizTypePlugin.java @@ -0,0 +1,69 @@ +package shkd.repc.rebm.formplugin; + +import kd.bos.bill.AbstractBillPlugIn; +import kd.bos.dataentity.entity.DynamicObject; +import kd.bos.entity.datamodel.IDataModel; +import kd.bos.entity.datamodel.events.ChangeData; +import kd.bos.entity.datamodel.events.PropertyChangedArgs; +import kd.bos.form.IFormView; +import kd.sdk.plugin.Plugin; + +import java.util.EventObject; + +/** + * 单据界面插件 + */ +public class ControlFieldOnBizTypePlugin extends AbstractBillPlugIn implements Plugin { + + /* + * 采购需求单-根据业务类型控制字段和容器显隐 + * */ + + @Override + public void afterBindData(EventObject e) { + super.afterBindData(e); + IDataModel model = this.getModel(); + IFormView view = this.getView(); + DynamicObject bizType = (DynamicObject) model.getValue("qeug_biztype"); + if (bizType != null) { + String number = bizType.getString("number"); + if ("pur-001".equals(number)) { + view.setVisible(true, "qeug_renovation_proj", "qeug_renovation_pur", "qeug_renovation_scop", "qeug_renovation_type", "qeug_softdecoration", "qeug_emt_bp", "qeug_proj_budget", "qeug_soft_budget"); + } else if ("pur-002".equals(number)) { + view.setVisible(true, "qeug_purchase_type", "qeug_applyamount", "qeug_outline"); + } else if ("pur-003".equals(number)) { + view.setVisible(true, "qeug_purchase_type", "qeug_applyamount", "qeug_outline", "advconap"); + } else if ("pur-004".equals(number) || "pur-005".equals(number) || "pur-006".equals(number)) { + view.setVisible(true, "qeug_applyamount", "qeug_outline", "advconap"); + } + } + } + + @Override + public void propertyChanged(PropertyChangedArgs e) { + super.propertyChanged(e); + String name = e.getProperty().getName(); + if ("qeug_biztype".equals(name)) { + ChangeData changeData = e.getChangeSet()[0]; + Object newValue = changeData.getNewValue(); + IFormView view = this.getView(); + view.setVisible(false, "qeug_renovation_proj", "qeug_renovation_pur", "qeug_renovation_scop", "qeug_renovation_type", + "qeug_softdecoration", "qeug_emt_bp", "qeug_proj_budget", "qeug_soft_budget", "qeug_purchase_type", + "qeug_applyamount", "qeug_outline", "advconap"); + + if (newValue != null) { + DynamicObject bizType = (DynamicObject) newValue; + String number = bizType.getString("number"); + if ("pur-001".equals(number)) { + view.setVisible(true, "qeug_renovation_proj", "qeug_renovation_pur", "qeug_renovation_scop", "qeug_renovation_type", "qeug_softdecoration", "qeug_emt_bp", "qeug_proj_budget", "qeug_soft_budget"); + } else if ("pur-002".equals(number)) { + view.setVisible(true, "qeug_purchase_type", "qeug_applyamount", "qeug_outline"); + } else if ("pur-003".equals(number)) { + view.setVisible(true, "qeug_purchase_type", "qeug_applyamount", "qeug_outline", "advconap"); + } else if ("pur-004".equals(number) || "pur-005".equals(number) || "pur-006".equals(number)) { + view.setVisible(true, "qeug_applyamount", "qeug_outline", "advconap"); + } + } + } + } +} \ No newline at end of file diff --git a/main/java/shkd/repc/rebm/formplugin/ImportPurchaseApplyBillPlugin.java b/main/java/shkd/repc/rebm/formplugin/ImportPurchaseApplyBillPlugin.java index 0f7f193..0d9b975 100644 --- a/main/java/shkd/repc/rebm/formplugin/ImportPurchaseApplyBillPlugin.java +++ b/main/java/shkd/repc/rebm/formplugin/ImportPurchaseApplyBillPlugin.java @@ -26,6 +26,10 @@ import kd.sdk.plugin.Plugin; */ public class ImportPurchaseApplyBillPlugin extends AbstractBillPlugIn implements Plugin { + /* + * 采购计划单/标前预备会-引入采购需求单 + * */ + String[] fields = new String[]{ "qeug_auditoption", "qeug_option",