添加注解、根据业务类型控制字段和容器显隐

This commit is contained in:
ggxl 2024-11-30 10:45:24 +08:00
parent 8e811812bc
commit 2fc35ed948
2 changed files with 73 additions and 0 deletions

View File

@ -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");
}
}
}
}
}

View File

@ -26,6 +26,10 @@ import kd.sdk.plugin.Plugin;
*/
public class ImportPurchaseApplyBillPlugin extends AbstractBillPlugIn implements Plugin {
/*
* 采购计划单/标前预备会-引入采购需求单
* */
String[] fields = new String[]{
"qeug_auditoption",
"qeug_option",