diff --git a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/TripReqBillPlugin.java b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/TripReqBillPlugin.java new file mode 100644 index 0000000..a636c7f --- /dev/null +++ b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/TripReqBillPlugin.java @@ -0,0 +1,55 @@ +package zcgj.zcdev.zcdev.fs.plugin.form; + +import kd.bos.bill.AbstractBillPlugIn; +import kd.bos.dataentity.entity.DynamicObject; +import kd.bos.form.field.ComboEdit; +import kd.bos.form.field.TextEdit; +import kd.bos.orm.query.QCP; +import kd.bos.orm.query.QFilter; +import kd.bos.servicehelper.QueryServiceHelper; + +import java.util.EventObject; + +/** + * 出差申请单表单插件 + */ +public class TripReqBillPlugin extends AbstractBillPlugIn { + + @Override + public void afterCopyData(EventObject e) { + super.afterCopyData(e); + updateModificationTypeVisibility(); + } + + @Override + public void afterBindData(EventObject e) { + super.afterBindData(e); + updateModificationTypeVisibility(); + } + + @Override + public void afterCreateNewData(EventObject e) { + super.afterCreateNewData(e); + updateModificationTypeVisibility(); + } + + private void updateModificationTypeVisibility() { + Boolean isChange = (Boolean) this.getModel().getValue("ischange");//是否变更 + + DynamicObject costCompany = (DynamicObject) this.getModel().getValue("costcompany");//费用承担公司 + QFilter filter = new QFilter("zcgj_companyblentry.zcgj_org.id", QCP.equals, costCompany.getPkValue()); + filter.and(new QFilter("number", QCP.equals, "001")); + filter.and(new QFilter("zcgj_changetype", QCP.equals, true)); + DynamicObject companyBelong = QueryServiceHelper.queryOne("zcgj_companybelong", "id", new QFilter[]{filter});//公司归属区域 + + if (isChange && companyBelong != null) { + this.getView().setVisible(true, "zcgj_modificationtype");//变更类型可见 + ComboEdit edit = this.getView().getControl("zcgj_modificationtype"); + edit.setMustInput(true);//变更类型必录 + } else { + this.getView().setVisible(false, "zcgj_modificationtype");//变更类型不可见 + ComboEdit edit = this.getView().getControl("zcgj_modificationtype"); + edit.setMustInput(false);//变更类型不必录 + } + } +}